Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: XML::Simple giving a non-specific error

by Anonymous Monk
on Mar 12, 2010 at 00:23 UTC ( #828169=note: print w/ replies, xml ) Need Help??


in reply to Re^2: XML::Simple giving a non-specific error
in thread XML::Simple giving a non-specific error

That's not the case, as seen in the update to my post.

Your update shows how LibXML, a parser which builds a tree (takes more memory), can provide better error messages than a simpler parser like expat.


Comment on Re^3: XML::Simple giving a non-specific error
Re^4: XML::Simple giving a non-specific error
by ikegami (Pope) on Mar 12, 2010 at 00:30 UTC
    You seem to be implying that the fact that it builds a tree is relevant (if XML::LibXML::SAX even builds a tree). It's not. To be able to provide the error message it already provides, the parser needs a list of unclosed elements.
    my @unclosed = ( 'ROOT', 'ERROR', 'ERROR', );
    All that's needed to provide a better error message is to note a line number along with the name of the element.
    my @unclosed = ( [ 'ROOT', 3 ], [ 'ERROR', 8 ], [ 'ERROR', 8 ], );

    Yes, it uses extra memory, but 1) it doesn't add to the magnitude (O()) of the memory used, 2) the maximum used is proportional to the depth of tree and they're usually quite shallow (20?).

    As for expat being simpler, its actually almost identical to SAX. It wouldn't surprise me if one inspired the other.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://828169]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-12-26 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls