What should this print in your opinion?
use XML::Simple; my $parser = new XML::Simple( forcearray => [qw(AREA LOCALE)], suppressempty => '', ); $data = $parser->XMLin(<<'*END*'); <root> <empty></empty> <whitespace> </whitespace> <full>ahoj</full> <with_spaces> cau </with_spaces> </root> *END* use Data::Dumper; print Dumper($data);
Considering that NormaliseSpace is by default 0 which means "whitespace is passed through unaltered (except of course for the normalisation of whitespace in attribute values which is mandated by the XML recommendation)" I think it should print
$VAR1 = {
'whitespace' => ' ',
'with_spaces' => ' cau ',
'empty' => '',
'full' => 'ahoj'
};
XML::Simple disagrees and its result is
$VAR1 = {
'whitespace' => '',
'with_spaces' => ' cau ',
'empty' => '',
'full' => 'ahoj'
};
As you can see the content of the whitespace tag was removed.
Now I can understand why you would not want to end up with
$VAR1 = {
'whitespace' => ' ',
'with_spaces' => ' cau ',
'content' => [
'
',
'
',
'
',
'
',
'
'
],
'empty' => '',
'full' => 'ahoj'
};
but returning the same for <tag></tag> and <tag> </tag> doesn't seem entirely correct. To me at least.
Jenda
| XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented. |
In reply to XML::Simple bug? aka I want the whitespace dude! by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |