[Melbourne-pm] XML parsing

Alfie John alfiejohn at acm.org
Fri Mar 25 02:16:21 PST 2005


Hi Leif,

> Also, to get more speed from XML::Simple, you can use 
> XML::Parser as the 
> backend SAX-generator rather than the default pure perl code of 
> XML::SAX. I benchmarked a range of SAX-generators here 
> <http://perlmonks.org/?node_id=409517> , so I would recommend 
> XML::Parser. Just set $XML::Simple::PREFERRED_PARSER or the envvar 
> XML_SIMPLE_PREFERRED_PARSER to the SAX-generator you prefer. 
> XML::Parser 
> will speed up all XML::Simple operation *significantly* - for example 
> from 13 seconds to 3 seconds.

After setting $XML::Simple::PREFERRED_PARSER to 'XML::Parser', it died
straight away informing me it was not well formed. Regardless of speed,
this is what I was looking for :)

Looks like XML::Simple doesn't like not well formed XML.

> Note, I dont think XML::Parser will tell you the XML is 
> invalid, but it 
> will tell you the XML is not well formed - I cant seem to find any 
> reference to XML::Parser being a validating parser.

Sorry, that's what I meant ;)

Thanks for the help!

int 20h;
Alfie John



More information about the Melbourne-pm mailing list