Re: rexml exceptions
- From: Eric Will <rakaur@xxxxxxxxxxx>
- Date: Tue, 30 Sep 2008 10:42:32 -0500
On Tue, Sep 30, 2008 at 9:59 AM, Mark Thomas <mark@xxxxxxxxxxxxxx> 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
<title>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
.
- References:
- rexml exceptions
- From: Eric Will
- Re: rexml exceptions
- From: Mark Thomas
- rexml exceptions
- Prev by Date: Re: exception in thread? in Net::SSH::Multi
- Next by Date: Re: C fwrite equivalent in ruby
- Previous by thread: Re: rexml exceptions
- Next by thread: Re: rexml exceptions
- Index(es):