in reply to Re^2: XML::LibXML findnodes and namespaces
in thread XML::LibXML findnodes and namespaces
I think without modification to your XPath, the task is not only difficult, but impossible. I don't see any possibility how plain fooResponse in your XPath expression could match with namespace qualified fooResponse element in your document.
If you want to use XPath and match names regardless namespaces, the name() test is the only solution I can find. The original XPath expressions can be turned to name() variant programmatically (below is my first try).
sub name_matching_xpath { my ($xpath) = @_; return join '/', map { /^([a-z0-9:-]+)(.*)$/i ? "*[name() = '$1']$2" : $_; } sp +lit '/', $xpath; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: XML::LibXML findnodes and namespaces
by shamu (Acolyte) on Mar 30, 2007 at 21:00 UTC |
In Section
Seekers of Perl Wisdom