Hi James,

Thanks for the test case and report.

  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.

You might want to use XPath instead for this.

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.

So I tested this with libxml-ruby 1.1.2, ruby 1.8.6 (patch level 287) on Windows Vista and Fedora 10 and could not reproduce.

Am I use the Reader bindings correctly?

Yes.

If I'm not, I'd appreciate a few pointers.

Since I can't reproduce the problem, can you compile the bindings with debug information and get a stack trace?

Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to