Nokogiri sax parser error

Discussion in 'Ruby' started by Trans, Feb 8, 2009.

  1. Trans

    Trans Guest

    Trying to use the Nokogiri Sax parser. I ran into a problem parsing
    the following:

    <html>
    <head>
    </head>
    <body>
    <try x="<x/>" />
    </body>
    </html>

    It chokes on the x="<x/>" attribute.

    T.
     
    Trans, Feb 8, 2009
    #1
    1. Advertising

  2. Trans

    Mike Cargal Guest

    That's because it's not valid xml (or html). You'd need to escape the
    < and >

    <try x="&lt;x/&gt;: />


    On Feb 8, 2009, at 10:20 AM, Trans wrote:

    > Trying to use the Nokogiri Sax parser. I ran into a problem parsing
    > the following:
    >
    > <html>
    > <head>
    > </head>
    > <body>
    > <try x="<x/>" />
    > </body>
    > </html>
    >
    > It chokes on the x="<x/>" attribute.
    >
    > T.
    >
     
    Mike Cargal, Feb 8, 2009
    #2
    1. Advertising

  3. Trans

    Mike Cargal Guest

    Oops typo...

    > <try x="&lt;x/&gt;" />



    On Feb 8, 2009, at 10:25 AM, Mike Cargal wrote:

    > That's because it's not valid xml (or html). You'd need to escape
    > the < and >
    >
    > <try x="&lt;x/&gt;: />
    >
    >
    > On Feb 8, 2009, at 10:20 AM, Trans wrote:
    >
    >> Trying to use the Nokogiri Sax parser. I ran into a problem parsing
    >> the following:
    >>
    >> <html>
    >> <head>
    >> </head>
    >> <body>
    >> <try x="<x/>" />
    >> </body>
    >> </html>
    >>
    >> It chokes on the x="<x/>" attribute.
    >>
    >> T.
    >>

    >
    >
     
    Mike Cargal, Feb 8, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Brogden
    Replies:
    1
    Views:
    8,371
    Manoj S. P.
    Jun 30, 2003
  2. Bart
    Replies:
    0
    Views:
    477
  3. Sidhartha
    Replies:
    1
    Views:
    524
    Martin Honnen
    Sep 15, 2008
  4. Rickard Lindberg

    Unicode error in sax parser

    Rickard Lindberg, Feb 8, 2011, in forum: Python
    Replies:
    0
    Views:
    196
    Rickard Lindberg
    Feb 8, 2011
  5. Michel Demazure

    Nokogiri SAX parser encoding problem

    Michel Demazure, Aug 24, 2010, in forum: Ruby
    Replies:
    6
    Views:
    347
    Michel Demazure
    Aug 25, 2010
Loading...

Share This Page