Problems? Is your data what you think it is? | |
PerlMonks |
XML::LibXML & namespacesby breezykatt (Acolyte) |
on Oct 03, 2016 at 21:37 UTC ( [id://1173191]=perlquestion: print w/replies, xml ) | Need Help?? |
breezykatt has asked for the wisdom of the Perl Monks concerning the following question:
Hi - I'm using XML::LibXML to read/parse various xml files. I'm running into an issue where the xml files contain namespaces in different places (either at the top of page or within the xml tags). Additionally, the namespace numbers change per xml file for the same tags. So I wrote a script to parse the namespaces and use them accordingly. The script only works for when the namespaces are at the top of the page. When the namespaces are within the tags, I'm running into the following error: XPath error : Undefined namespace prefix error : xmlXPathCompiledEval: evaluation failed The code is straight forward, but I must be missing something obvious. I tried putting in the full page, changing "//" to "/" with full path. I tried other tags at different levels in the xml hierarchy, but the only time it works is when there isn't a namespace used. Any ideas on how to get this working? Thanks.
XML snippet for where it fails
Back to
Seekers of Perl Wisdom
|
|