Actually, thinking about it - one of the fundamental problems here, is that the transformation between XML to has breaks down - because what you have in XML is:
- Nodes beneath the same parent with the same name
- Ordered named nodes
- Attributes - which logically would be a hash, but if they do, they contend with children
So with that in mind - you can craft XML that passes through XML::Simple painlessly by not doing any of those things:
<xml>
<element>value</element>
<another_element>a different value</another_element>
</xml>
The irony is though - if your XML is that simple, then you didn't need XML::SImple either:
my %stuff = $xml =~ m/(\w+)>([^<]+)</g;
But as we know - it's a bad idea to parse XML with a regex - I think it's a bad idea to use XML::Simple for exactly the same reasons. (And you need to install it too) |