Bugs item #27848, was opened at 2010-02-17 05:52
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=27848&group_id=494

Category: General
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Jarl Friis (jarl)
>Assigned to: Charlie Savage (cfis)
Summary: Error#code_to_s gives incosistent answer (sometimes wrong)

Initial Comment:
Hi.

Version 1.1.3

I experience that LibXML::XML::Error#code_to_s gives answers that varies 
arbitrary.

If I have a Empty document, the parse will give me a Error object with code 4.
but when I use code_to_s on that object it some times returns "DOCUMENT EMPTY" 
and sometimes "DTD"

I believe it is because the constants defined in Error are not prefixed (as 
they are in libxml), hence there are two constants with the same value:

irb(main):004:0> XML::Error.const_get("DTD")
=> 4
irb(main):005:0> XML::Error.const_get("DOCUMENT_EMPTY")
=> 4

Jarl


----------------------------------------------------------------------

>Comment By: Charlie Savage (cfis)
Date: 2011-04-22 22:19

Message:
The code is correct.  Both XML::DTD and XML::DOCUMENT_EMPTY have the same 
value.  They come from two different enums defined in Libxml.  A bit confusing 
I know, but correct.

Thanks - Charlie

----------------------------------------------------------------------

Comment By: Jarl Friis (jarl)
Date: 2010-02-17 06:31

Message:
I have made a workaround file, I would not go so far as to
call it a patch... It's a monkey patch.

In a Rails app, the file can be placed in app/helpers,
which works around the problem. Note also my new
implementation only creates the number to name map once.

Jarl

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1971&aid=27848&group_id=494
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to