General Nokogiri problem

Discussion in 'Ruby' started by Srijayanth Sridhar, May 7, 2009.

  1. [Note: parts of this message were removed to make it a legal post.]

    Hello,

    On several sites(probably malformed HTML/JavaScript/XML/general parsing
    hell) I have the following problem.

    For ex:

    moonwolf@trantor:~/ruby$ irb
    irb(main):001:0> ['rubygems','nokogiri','hpricot','open-uri'].each { |r|
    require r }
    => ["rubygems", "nokogiri", "hpricot", "open-uri"]
    irb(main):002:0> doc=Nokogiri(open("http://maps.google.com/"))
    => <?xml version="1.0"?>
    <!DOCTYPE html>
    <html/>

    irb(main):003:0> doc/"a"
    =>

    Same with Nokogiri.Hpricot:

    irb(main):004:0> doc=Nokogiri.Hpricot(open("http://maps.google.com/"))
    => <?xml version="1.0"?>
    <!DOCTYPE html>
    <html/>

    However with regular Hpricot:

    irb(main):009:0> (Hpricot(open("http://maps.google.com/"))/"a").size
    => 53
    (the full post of course is too long, so just showed something simpler)


    Hpricot by itself of course works. I tried looking and there's not much by
    way of documentation or blogs on something like this.

    Any suggestions/explanations will be welcome as I like Nokogiri's speed very
    much.

    I am using:

    moonwolf@trantor:~/ruby$ gem list --local | grep -i nokogiri
    nokogiri (1.2.3)
    moonwolf@trantor:~/ruby$ ruby --version
    ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-linux]


    Jayanth
     
    Srijayanth Sridhar, May 7, 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. Thomas Brandon

    Treeview image problem (or general cache problem)

    Thomas Brandon, Aug 18, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    261
    Niraj Bhatt
    Sep 15, 2003
  2. Aaron Patterson

    [ANN] nokogiri 1.0.0 Released

    Aaron Patterson, Oct 31, 2008, in forum: Ruby
    Replies:
    0
    Views:
    187
    Aaron Patterson
    Oct 31, 2008
  3. Aaron Patterson

    [ANN] nokogiri 1.0.3 Released

    Aaron Patterson, Nov 4, 2008, in forum: Ruby
    Replies:
    0
    Views:
    213
    Aaron Patterson
    Nov 4, 2008
  4. Diogo Terror

    Nokogiri problem on Mac OS X

    Diogo Terror, Nov 21, 2008, in forum: Ruby
    Replies:
    3
    Views:
    219
    Diogo Terror
    Nov 25, 2008
  5. malikb
    Replies:
    0
    Views:
    164
    malikb
    Apr 22, 2009
  6. Philip Stephens

    Simple problem using Nokogiri xml eaderr

    Philip Stephens, Nov 12, 2009, in forum: Ruby
    Replies:
    2
    Views:
    237
    Aaron Patterson
    Nov 12, 2009
  7. Priyank Shah
    Replies:
    3
    Views:
    147
    Luis Lavena
    Aug 3, 2010
  8. Michel Demazure

    Nokogiri SAX parser encoding problem

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