From: Eric Will Date: 2008-10-01T00:42:32+09:00 Subject: Re: rexml exceptions On Tue, Sep 30, 2008 at 9:59 AM, Mark Thomas wrote: > Out of curiosity, I tried libxml. It has nice error messages: > > foo.xml:3: > parser error : > Opening and ending tag mismatch: title line 3 and txitle > Foo</txitle> > ^ > > but they go to stdout. You can capture them by registering an error > handler. Sample code: > > parser = XML::Parser.new > parser.filename = "foo.xml" > > msgs = [] > XML::Parser.register_error_handler lambda { |msg| msgs << msg } > > begin > parser.parse > rescue Exception => e > puts "Error: #{msgs}" > end Interesting. I was thinking about doing libxml anyway. I do not like REXML. Thanks. > -- Mark. -- rakaur