Code Comments
Programming Forum and web based access to our favorite programming groups.
I did this shell command
perl -e 'use XML::Simple qw(:strict); use Data::Dumper; print
Dumper(XMLin("<xxx><_a>b</_a></xxx>", 'ForceArray' => 1, KeyAttr => []))
' >
delete.txt
And the output was
$VAR1 = {
'__a' => [
'b'
]
};
I was aspecting
$VAR1 = {
'_a' => [
'b'
]
};
What am I doing wrong?
Marcos
Post Follow-up to this message>
> I did this shell command
>
> perl -e 'use XML::Simple qw(:strict); use Data::Dumper; print
> Dumper(XMLin("<xxx><_a>b</_a></xxx>", 'ForceArray' => 1, KeyAttr =>
[]))' >
> delete.txt
>
> And the output was
>
> $VAR1 = {
> '__a' => [
> 'b'
> ]
> };
>
> I was aspecting
>
> $VAR1 = {
> '_a' => [
> 'b'
> ]
> };
>
> What am I doing wrong?
>
I suspect XML::Simple thinks your XML is not well formed because your
tag names start with an underscore. See point #2 here:
http://search.cpan.org/~grantm/XML-...mple.pm#Caveats
Which essentially gives it artistic license to do what it wants. Whether
this is a bug or just "you shouldn't do that it is bad for your health"
is hard to say...
In addition on my Perl 5.8.0, XML::Simple 2.0.7 on RH Linux 9, and in
Perl 5.6.1, XML::Simple 2.0.5, on Solaris 8, I get the output you expect.
http://danconia.org
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.