Subject: | XMLout change XML structure |
Date: | Wed, 26 Mar 2008 17:17:36 +0100 |
To: | bug-XML-Simple [...] rt.cpan.org |
From: | AM Courrier <am.courrier [...] gmail.com> |
Hi,
I'm working on a sort of proxy for an XML protocol. I discovered
XML::Simple which do a good job for that with XMLin and XMLout... but I
have a problem in some cases.
Here is my code sample :
"
$xml = <<EOF;
<message><option><value>my_value</value></option></message>
EOF
print "---------- BEFORE XMLin \n".$xml."\n";
$ref = XMLin($xml, ForceContent => 1, KeepRoot => 1, KeyAttr => undef);
print Dumper($ref);
$xml2 = XMLout($ref, NoEscape => 0, NoIndent => 1, NoSort => 1,
RootName => undef);
print "---------- AFTER XMLout \n".$xml2."\n";
"
Here is the STDOUT :
"
---------- BEFORE XMLin
<message><option><value>my_value</value></option></message>
$VAR1 = {
'message' => {
'option' => {
'value' => {
'content' => 'my_value'
}
}
}
};
---------- AFTER XMLout
<message name="option"><value>my_value</value></message>
"
The resulting structure is different from the initial's one.
I read and read anew docs and FAQ, played with options like (VarAttr,
ValueAttr, ...) but I didn't find the solution.
Could you help me (by telling me how to do to make this working) ?
Regards
Alain