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.
| [reply] |
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.
| [reply] [d/l] |