#! /usr/bin/perl use warnings; use strict; use feature qw{ say }; use XML::LibXML; my @xmls = (<< '__XML1__', << '__XML2__'); <?xml version="1.0" encoding="utf-8" ?> <propfind xmlns="DAV:"> <propname/> </propfind> __XML1__ <?xml version="1.0" encoding="utf-8" ?> <D:propfind xmlns:D="DAV:"> <D:propname/> </D:propfind> __XML2__ for my $xml (@xmls) { my $xpc = 'XML::LibXML::XPathContext'->new; $xpc->registerNs('x', 'DAV:'); my $doc = 'XML::LibXML'->load_xml(string => $xml); say $xpc->find('count(//x:propname)', $doc); }
In reply to Re^5: xmlns and XML::LibXML ( local-name() )
by choroba
in thread xmlns and XML::LibXML
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |