Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^4: Examples where XML::Simple is the optimal choice?

by Preceptor (Deacon)
on Oct 23, 2015 at 21:53 UTC ( [id://1145818]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Examples where XML::Simple is the optimal choice?
in thread Examples where XML::Simple is the optimal choice?

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)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 19:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found