Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: best XML parser in 5.18

by ikegami (Patriarch)
on May 22, 2015 at 17:12 UTC ( [id://1127488]=note: print w/replies, xml ) Need Help??


in reply to best XML parser in 5.18

There are no XML parsers in the official Perl distribution.

XML::Simple is probably the most popular parser, but it's a really poor parser. Its own documentation instructs you not to use it. Other than XML::Simple, the most popular XML parsers are XML::LibXML (a very fast, full-featured parser with a DOM-based interface) and XML::Twig (a reasonably fast full-featured parser with a more Perlish interface).

I've done extensive benchmarking in the past, and the only one faster than XML::LibXML was XML::Bare[1]. No other was even close. XML::Bare has a number of problems, though. 1) You must decode the document before parsing it. 2) It doesn't support namespaces or namespace prefixes. 3) While it can support virtually all XML formats, there are some it can't. XHTML is one it can't. 3) It's tricky to extract information from the tree (since it has the same somtimes-array-sometimes-elememt problem XML::Simple has).


  1. XML::LibXML was faster at parsing than XML::Bare, but XML::Bare was faster when you also included the time to extract information from the tree. The time taken to strip the prefixes from the elements (since XML::Bare can't handle them) was included in the benchmark.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-25 07:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found