Subject: | Mention registerNs is needed on every level |
On XML::LibXML::Node there is a "NOTE ON NAMESPACES AND XPATH".
In it a better example would:
1. Show registerNs is needed every level, not just once.
2. Stretch all the way back to when we loaded the file.
my $doc = XML::LibXML->load_xml(...);
my $xc = XML::LibXML::XPathContext->new($doc);
$xc->registerNs( 'g', 'http://www.topografix.com/GPX/1/1' );
for ( $xc->findnodes('/g:gpx/g:wpt') ) {
my $xc2 = XML::LibXML::XPathContext->new($_);
$xc2->registerNs( 'g', 'http://www.topografix.com/GPX/1/1' );
for ('name') {
my $p = $xc2->findvalue("g:$_"); ...