problem with Nokogiri::HTML::Element#line

Discussion in 'Ruby' started by malikb, Apr 22, 2009.

  1. malikb

    malikb Guest

    Hello,

    I have a problem with Nokogiri::HTML::Element#line, it always returns
    zero(0):

    html = Nokogiri::HTML(<<eohtml)
    <html>
    <head>
    <title>test test</title>
    </head>
    <body>
    Hello, world!
    </body>
    </html>
    eohtml

    html.xpath("/html/head/title")[0].line # 0
    html.xpath("/html/body")[0].line # 0

    if I replace Nokogiri::HTML with Nokogiri::XML, all going to be
    perfect.

    Nokogiri::HTML::Element extends Nokogiri::XML::Node, so, #line should
    return the line of the HTML node, isn't it?
     
    malikb, Apr 22, 2009
    #1
    1. Advertisements

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. Hugo
    Replies:
    10
    Views:
    1,616
    Matt Humphrey
    Oct 18, 2004
  2. kaushikshome
    Replies:
    4
    Views:
    1,040
    kaushikshome
    Sep 10, 2006
  3. HANM
    Replies:
    2
    Views:
    1,517
    Joseph Kesselman
    Jan 29, 2008
  4. scad
    Replies:
    23
    Views:
    1,478
    Alf P. Steinbach
    May 17, 2009
  5. Jarmo Pertman
    Replies:
    2
    Views:
    198
    Jarmo Pertman
    May 21, 2009
  6. Priyank Shah
    Replies:
    5
    Views:
    249
    Priyank Shah
    Nov 15, 2010
  7. Marek Stepanek
    Replies:
    12
    Views:
    695
    Peter J. Holzer
    Sep 2, 2006
  8. Replies:
    0
    Views:
    659
Loading...