wufnik has asked for the wisdom of the Perl Monks concerning the following question:
although the xml generated is entirely the same in content (*not* memory locations), neither xml_compare nor xml_identity return true. the latter i understand, the former frustrates me, as i was hoping to use it to check whether 2 data structures were equal in content.use XML::Dumper; my $struct = { "ferret" => ["sredni", "vashtar"], "hen" => "anabaptist", }; my $xdumper = new XML::Dumper; # generate xml equiv to struct my $ssxmlified = $xdumper->pl2xml($struct); # write it to file as well $xdumper->pl2xml($struct, "oot.txt"); # reconstitute our struct from the file my $structreconstituted = $xdumper->xml2pl("oot.txt"); # generate xml===reconstituted struct $rexmlified = $xdumper->pl2xml($structreconstituted); my $sscequal = $xdumper->xml_compare($rexmlified, $ssxmlified); my $ssiequal = $xdumper->xml_identity($rexmlified, $ssxmlified); printf "xml_compare: %s\n", ($sscequal? "true" : "false"); printf "xml_identity:%s\n", ($ssiequal? "true" : "false");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Dumper: Nifty or Naughty?
by Jaap (Curate) on May 09, 2003 at 10:46 UTC | |
by wufnik (Friar) on May 09, 2003 at 14:03 UTC | |
by wufnik (Friar) on May 09, 2003 at 14:20 UTC | |
|
Re: XML::Dumper: Nifty or Naughty?
by bobn (Chaplain) on May 09, 2003 at 16:49 UTC |