Tuesday, 10 September 2013

Perl XML::TinyXML getNode returning undef()

Perl XML::TinyXML getNode returning undef()

I seem to be having issues with the CPAN module for XML::TinyXML such that
when I create a new xml object, any subsequent call to getNode always
returns undef.
Currently using TinyXML 0.33 This worked previously with TinyXML 0.11, and
all the examples suggest this should work.
A simple example.
#!/usr/bin/perl
use strict;
use warnings;
use XML::TinyXML;
my $node = XML::TinyXML::Node->new ('rowset', 'foo', {
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance"
});
my $xml = XML::TinyXML->new($node);
our $rootNode;
printf("%s \n", $xml->dump);
$rootNode = $xml->getNode("rowset");
print $rootNode;
Produces the following output
<?xml version="1.0" encoding="utf-8"?>
<rowset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">foo</rowset>
Use of uninitialized value $rootNode in print at ./z.pl line 18.
I'm stumped... Nothing I do will return the node object.
Thanks

No comments:

Post a Comment