Skip Menu |

This queue is for tickets about the XML-Elemental CPAN distribution.

Report information
The Basics
Id: 52868
Status: open
Priority: 0/
Queue: XML-Elemental

People
Owner: Nobody in particular
Requestors: d.oliveira [...] prozone.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.11



Subject: XML root element gets empty
Hello. Returning a XML::Elemental::Element (example, the root node) on a sub, may result on an empty element. On the attached example, I get a XML, parse it and return the root node. The result is: ZeMacBook:Desktop david$ ./test_xml_elemental.pl $VAR1 = bless( {}, 'XML::Elemental::Element' ); When we uncomment the line #11 the script returns the (my) expected output, the dump of parsed XML. Is this a bug? I started to get this behavior when I upgraded from 2.0 to 2.11. Thank you.
Subject: test_xml_elemental.pl
#!/usr/bin/perl use XML::Elemental; use LWP::Simple; sub getXMLRootNode { my ($url) = @_; my $doc = getXML($url); my $root = $doc->root_element; # $doc->{contents} = []; return $root; } sub getXML { my ($url) = @_; my $p = XML::Elemental->parser({}); my $code = get($url); my $doc = $p->parse_string($code); return $doc; } my $xml = getXMLRootNode("http://services.sapo.pt/News/RSS"); use Data::Dumper; print Dumper($xml);
Greetings, Just a debugging tip, commenting the following line (in the DESTROY sub) in Document.pm the above script works as intended. $_[0]->{contents}->DESTROY if $_[0]->{contents}; Thank you.