Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Operating on XML, or XML::Simple is too simple!

by mirod (Canon)
on Aug 05, 2005 at 06:25 UTC ( #481104=note: print w/replies, xml ) Need Help??


in reply to Operating on XML, or XML::Simple is too simple!

IMHO XML::Simple is used when you don't really care about the XML. Either you just use it as "just another storage format", or you just load it and use the data. Because you loose some information when you load data using XMLin, it is hard to get exactly what you want with XMLout.

If you really want to process XML documents you have to use a different kind of module, one which models the XML more faithfully than XML::Simple.

My recommendation would be to go either with XML::LibXML or with XML::Twig.

XML::LibXML is based on libxml2, which you have to install first (it should be already installed on most linux systems). It implements very rigourously a whole bunch of standards: XML, DOM, XPath... While the DOM is a bit of a pain to use (it is very verbose) you might already be familiar with it if you use Javascript, and the combination DOM + XPath is very powerful.

XML::Twig (which I wrote, so I might be a little bit biased ;--) is based on XML::Parser and on expat which you might have to install (it is already installed with Activestate Perl and on a lot of *nix systems). It is more perlish and concise than XML::LibXML but it doesn't implement as many standards, and the docs are... huge!

I would avoid XML::Parser at this point, it is not very well supported and is a bit too low level. You could also use some of the SAX modules, but they are probably not worth the pain unless you like low-level context management.

  • Comment on Re: Operating on XML, or XML::Simple is too simple!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2020-11-25 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?