in reply to Re^3: XML compare with a key
in thread XML compare with a key
For such simple stuff the module is still useful.
I agree that the module can still be used for very simple cases, like reading simple config files in a known format (Update: although there are better modules available, such as XML::Rules). However, we don't know if the OP's actual XML really is as simple as the example shown in the root node, therefore whether it will work at all (see code below), and you also didn't mention any of the major caveats associated with that module, which is why I posted my comment.
use warnings; use strict; use Data::Dump; use XML::Simple qw/:strict XMLin/; dd XMLin('<root><x><y>Foo</y></x></root>',ForceArray=>[],KeyAttr=>[]); dd XMLin('<root><x y="Foo"></x></root>', ForceArray=>[],KeyAttr=>[]); __END__ { x => { y => "Foo" } } { x => { y => "Foo" } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: XML compare with a key
by hdb (Monsignor) on Apr 02, 2019 at 12:53 UTC | |
by haukex (Archbishop) on Apr 02, 2019 at 13:01 UTC | |
by hdb (Monsignor) on Apr 02, 2019 at 13:04 UTC | |
by ikegami (Patriarch) on Apr 02, 2019 at 13:23 UTC |