Hi Charlie, Actually, it was at the bottom of my original mail months ago, but here it is again:
Hope it helps, ast On 7 Jun 2010, at 6:54, Charlie Savage wrote: >>>> excalibur$ cat /tmp/puke.rb >>>> require 'rubygems' >>>> require 'xml' >>>> >>>> class Handler >>>> def on_cdata_block(cdata) >>>> end >>>> >>>> def on_characters(chars) >>>> end >>>> >>>> def on_comment(text) >>>> end >>>> >>>> def on_end_document >>>> end >>>> >>>> def on_error(error) >>>> end >>>> >>>> def on_processing_instruction(target, data) >>>> end >>>> >>>> def on_start_document >>>> end >>>> >>>> def on_start_element(qname, attributes) >>>> end >>>> >>>> def on_end_element(qname) >>>> end >>>> >>>> def on_start_element_ns(qname, attributes, prefix, uri, nslist) >>>> raise RuntimeError, "die a horrible death!" >>>> end >>>> >>>> def on_end_element_ns(qname, prefix, uri) >>>> end >>>> end >>>> >>>> parser = XML::SaxParser.string(File.new(ARGV[0]).read) >>>> parser.callbacks = Handler.new >>>> begin >>>> parser.parse >>>> rescue RuntimeError => e >>>> STDERR.puts "oops: #{e}" >>>> end >>>> >>>> Here's the input: >>>> excalibur$ cat /tmp/test.xml >>>> <MyElement xmlns="http://example.com/schemas/v1"/> >>>> >>>> Here's the output: >>>> excalibur$ ruby /tmp/puke.rb /tmp/test.xml >>>> oops: die a horrible death! >>>> *** glibc detected *** ruby: free(): invalid pointer: 0x00007f33b1503440 >>>> *** -- Andrew S. Townley <a...@atownley.org> http://atownley.org _______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel