http://qs321.pair.com?node_id=731578

AbrahamB has asked for the wisdom of the Perl Monks concerning the following question:

test.xml:
<?xml version="1.0" encoding="UTF-8"?> <root> <element1>Element1 content</element1> <element2>Element2 content</element2> </root>
Assuming I am using XML::LibXML correctly, does anyone have an idea why this returns expected result :
my $xpath = ‘/root’; my $test = $doc->findnodes($xpath); print Dumper($test); $VAR1 = bless( [ bless( do{\(my $o = 13079328)}, 'XML::LibXML::Element +' ) ], 'XML::LibXML::NodeList' );
…But this returns empty array?
my $xpath = ’/root and /root/element1’; my $test = $doc->findnodes($xpath); print Dumper($test); $VAR1 = bless( [], 'XML::LibXML::NodeList' );