Hi, the following script triggers a segfault for me under Linux, both
i386 and amd64.

---
  require 'rubygems'
  gem "libxml-ruby", "1.1.2"
  require 'libxml'

  filename = File.join(File.dirname(__FILE__), "bookwise.xml")
  reader = LibXML::XML::Reader.string(File.read(filename))

  while reader.read

    if reader.node_type == LibXML::XML::Reader::TYPE_ELEMENT
      if reader.name == "Header" 
        puts reader.read_outer_xml
      elsif reader.name == "Product"
        puts reader.read_outer_xml
      end
    end

  end
---

I'm basically attempting to grab the full text of all Header and Product
nodes in the input file. My actual code doesn't just puts the elements,
this is simply the simplest script I could make that triggers it.

Occasionally, instead of a segfault I get a fatal error, "Opening and
ending tag mismatch", despite the fact the input file is valid and well
formed.

The bookwise.xml file I'm testing with is available at
http://gir.deefa.com/bookwise.xml

I am running libxml-ruby 1.1.2 and libxml 2.7.3 on MRI 1.8.7. I have
also tested with libxml 2.6.32, and get the same result.

Am I use the Reader bindings correctly? If I'm not, I'd appreciate a few
pointers.

-- James Healy <jimmy-at-deefa-dot-com>  Sun, 22 Mar 2009 02:14:22 +1100
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to