Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

XML Processing

by rtremaine (Acolyte)
on Nov 19, 2005 at 15:02 UTC ( #510097=perlquestion: print w/replies, xml ) Need Help??
rtremaine has asked for the wisdom of the Perl Monks concerning the following question:

I need to process some XML docs. Seems to be a staggering array of modules to choose from. Ideally, I think I would like to be able to just feed it a schema (xsd) and the xml doc and be able to reference any element via a hash or object. Doc's are small, less than 100 total elements. Suggestions? Thanks again!

Replies are listed 'Best First'.
Re: XML Processing
by Tanktalus (Canon) on Nov 19, 2005 at 16:02 UTC

    Personally, I use XML::Twig for all things XML. It may be overkill for small things, but when you have a swiss army knife as your tool, well, all things look like something to cut, slice, uncork, hammer, screw, magnify, eat with a spoon, a fork, ... ;-)

    However, it does sound like XML::Simple may be a simpler choice for you - you probably want to Super Search for XML::Simple to see the types of problems that XML::Simple doesn't solve so you can evaluate for yourself prior to actually using it. Off the top of my head, if your doc has both attributes and content for the same element, saving your doc back out may lose the distinction. There may be ways around that, but a Super Search would likely prove helpful to do it right up front.

Re: XML Processing
by davido (Archbishop) on Nov 19, 2005 at 16:32 UTC

    I used to be sold on XML::Simple for most XML needs, but as planetscape pointed out to me not too long ago, XML::Twig will handle some XML data that XML::Simple simply chokes on.

    As I dug a little deeper into XML::Twig I found that it still has a simple mode that one can use, similar to XML::Simple's XMLin() method. In fact, it tries to closely emulate the behavior of XML::Simple when operating in simple mode. But in addition to the simple things, it can do so much more too.

    So I've begun re-implementing some of my existing tools using XML::Twig instead, and it gets my recommendation.


    Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://510097]
Approved by sweetblood
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2017-10-24 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (286 votes). Check out past polls.

    Notices?