Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 12/01/2008: Fun with libxml

David Goudreau
Monday, December 1, 2008

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.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

6 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.”

    December 1, 2008 at 10:57 pm

  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?

    December 2, 2008 at 5:20 pm

  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.

    December 2, 2008 at 9:45 pm

  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.

    December 4, 2008 at 12:29 am

  5. Brian Takita says:

    Works on my machine. :)

    * Ubuntu 8.10 Ruby 1.8.7p72
    * libxml-ruby 0.8.3

    January 8, 2009 at 6:40 pm

  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

    January 14, 2009 at 8:34 am

Add New Comment Cancel reply

Your email address will not be published.

David Goudreau

David Goudreau
San Francisco

Recent Posts

  • Standup 4/1/2011: April Fool's edition
  • Standup 3/31/2011: Process.spawn pwns all yer codez!
  • Standup 3/29/2011: Git it!
Subscribe to David's Feed

Author Topics

agile (14)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >