Is the here the call of documentElemtent
in the first example superfluous?
#!/usr/bin/env perl
use warnings;
use strict;
use XML::LibXML;
my $file = 'xml_file';
my $doc = XML::LibXML->load_xml( location => $file );
my $root = $doc->documentElement();
my $xpc = XML::LibXML::XPathContext->new( $root );
# ...
say $_->nodeName for $xpc->findnodes( '/' );
outputs
#document
$doc = XML::LibXML->load_xml( location => $file );
$xpc = XML::LibXML::XPathContext->new( $doc );
# ...
say $_->nodeName for $xpc->findnodes( '/' );
outputs also
#document