Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2018-07-20 16:55 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (438 votes). Check out past polls.