alienhuman has asked for the wisdom of the Perl Monks concerning the following question:
Hey Monks,
I'm using XML::Simple to slurp in, spit out xml for a project that's just in the prototype phase. I'm using the forcearray option as recommended, but I'm noticing something strange that I haven't been able to figure out by looking at the XML::Simple documentation (not saying it ain't in there, just that I can't seem to figure out where).
I'm starting with an xml document that looks like this:
<xml> <class instructor="young" subject="social studies" level="7" id="rm1 +02"> <student id="1"> <first_name>Francis</first_name> <last_name>Bustardo</last_name> </student> <student id="2"> <first_name>Escarlet</first_name> <last_name>Testamente</last_name> </student> <student id="3"> <first_name>Franco</first_name> <last_name>Coolamente</last_name> </student> </class> </xml>
And I'm using XMLin to slurp it in, passing the hashref to XMLout (calling with no options) and outputting the following xml as a result:
<opt> <class level="7" instructor="young" subject="social studies" name="r +m102"> <student name="1"> <first_name>Francis</first_name> <last_name>Bustardo</last_name> </student> <student name="2"> <first_name>Escarlet</first_name> <last_name>Testamente</last_name> </student> <student name="3"> <first_name>Franco</first_name> <last_name>Coolamente</last_name> </student> </class> </opt>
So my questions are:
-why is XML::Simple changing my <xml> to <opt>?
-why is it changing <student id="number"> to <student name="number">?
Thanks for any advice,
AH
p.s. I'm pretty new to xml and it's rules... I've been looking at the hash created using Data::Dumper and see that the resultant data structure doesn't retain the "id" name... can anyone help me figure out how to save that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple::XMLout() renaming tags
by Aristotle (Chancellor) on Oct 02, 2003 at 21:46 UTC | |
by dextius (Monk) on Oct 03, 2003 at 19:59 UTC | |
|
Re: XML::Simple::XMLout() renaming tags
by Cody Pendant (Prior) on Oct 02, 2003 at 21:35 UTC | |
|
Re: XML::Simple::XMLout() renaming tags
by vadim_t (Acolyte) on Oct 04, 2003 at 16:22 UTC |