Subject: | simplify behaves differently on empty element with and without CDATA |
Date: | Thu, 11 Sep 2014 19:14:10 +0300 |
To: | bug-XML-Twig [...] rt.cpan.org |
From: | Vangelis Katsikaros <vkatsikaros [...] gmail.com> |
Hi
First, thanks for this great module!
I encountered a difference in the behavior of XML::Twig->simplify when
parsing empty elements with and without CDATA sections.
============================
Reproduce the bug
============================
When running the test script, with no options to simplify I get:
perl test.pl
$VAR1 = {
'foo' => 'something'
};
$VAR1 = {
'foo' => ''
};
$VAR1 = {
'foo' => 'something'
};
$VAR1 = {
'foo' => undef
};
but I was expecting
perl test.pl
$VAR1 = {
'foo' => 'something'
};
$VAR1 = {
'foo' => undef
};
$VAR1 = {
'foo' => 'something'
};
$VAR1 = {
'foo' => undef
};
or at least have the same behavior (either undef or '') when the
element is empty both with and without CDATA .
============================
System details
============================
* verified with XML::Twig 3.48 (latest) and 3.32
* perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
* lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04.4 LTS
Release: 10.04
Codename: lucid
* uname -a
Linux xxxxx 2.6.32-41-server #94-Ubuntu SMP Fri Jul 6 18:15:07 UTC 2012
x86_64 GNU/Linux
============================
check perl code
============================
$ perl -c test.pl
test.pl syntax OK
$ perlcritic --stern test.pl
test.pl source OK
============================
check xml file
============================
$ xmllint --noout test.xml
$ xmllint --version
xmllint: using libxml version 20706
Regards
Vangelis Katsikaros
PS consider the attached test perl script and xml file to be under the
public domain. You can freely use, modify, and distribute them without
any restrictions.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.