Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
Standup 12/01/2008: Fun with libxml

Interesting Things

  • Libxml has been giving us some more strange behavior on Linux. If you do
parser = XML::Parser.new
parser.string = '<foo></foo>'
document = parser.parse

# Now watch me fail, but only on Linux!
parser.string = '<bar></bar>'
document = parser.parse
  • We’re hosting a MagLev tech talk today compliments of Martin McClure.

  • Joseph Palermo has won the annual Pivotal Labs Mustache Competition. Granted, he was the only entry. But don’t let that affect your admiration of his work. Photo to follow.

Comments
  1. Cody Caughlan says:

    I had issues with using the latest of LibXML on Rails 2.1 and acts_as_solr. I ended up having to load this patch into Rails

    if defined?(LibXML)
    class LibXML::XML::Node
    def property(key)
    properties[key] rescue nil
    end
    end
    end

    I do have this comment in that patch:

    “Oddity: we were previously using libxml-ruby v0.3.8.4 which has a method property() to retrieve the value
    of the named attribute. When we upgraded to the latest (as of Aug 2008), 0.8.3, Ruby code that was using this method failed
    with an error like this:

    undefined method `property’ for … :LibXML::XML::Node (NoMethodError)

    However, if you look at the C code for that version that method is clearly there and looks identical to the C in the 0.3.8.4 version.

    And if you load up an XML::Node class in console and then dump its properties you definitely dont see a +property+ method.

    So I dont know WHY this method is not available in the library when its clearly visible in the C code, but for now we can just re-open up the Node class and add in the method ourselves.”

  2. Jim Powers says:

    My setup:

    $ uname -a
    Linux nomad-phat 2.6.27.5-117.fc10.i686 #1 SMP Tue Nov 18 12:19:59 EST 2008 i686 athlon i386 GNU/Linux

    $ ruby -v
    ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]

    libxml-ruby (0.9.5)
    libxml (1.8.17-20.fc10)

    document = parser.parse
    RuntimeError: You cannot parse a data source twice
    from (irb):18:in `parse'
    from (irb):18
    from >:0

    This the same error you are getting?

  3. Adam Milligan says:

    @Jim,

    That is indeed the error. We’re using the same version and patch of Ruby that you list, and the same version of libxml.

    We had a suggestion that the error might be related to other errors we’ve been seeing in Ruby on Linux with that version/patch.

  4. Joseph Palermo says:

    @Cody,

    The “official” version of acts_as_solr doesn’t seem to be maintained. We ran into the same problem where acts_as_solr had patched libxml to work the way it wanted and newer versions of libxml don’t work that way anymore.

    It seems like most of the branches of acts_as_solr are being consolidated here: < http://github.com/mattmatt/acts_as_solr/tree/master>

    mattmatt has written a bunch of tests for acts_as_solr and is doing a great job of consolidating changes. We think it’s great.

  5. Brian Takita says:

    Works on my machine. :)

    * Ubuntu 8.10 Ruby 1.8.7p72
    * libxml-ruby 0.8.3

  6. francis sinson says:

    got this error for version 0.9.5:

    You cannot parse a data source twice in LibXML

    i installed 0.8.3 and put this

    gem ‘libxml-ruby’, ‘0.8.3’

    and that fixed the error.

    im on ubuntu 8.04

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *