Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I want to use XML::LibXML to process OpenOffice (sxw) files. OpenOffice stores its information in a Zip archive containing several XML files. I have extracted the content.xml file from such an archive. I have used XML::LibXML before, but never with XML documents that use namespaces. OpenOffice files use various namespaces for the different types of content. Normally, I would write something like: to retrieve all the nodes of type p. OpenOffice stores paragraphs in p elements within the text namespace. So, I replaced the findnodes line above with: but this returns the error XPath error Undefined namespace prefix in //text:p xmlXPathCompiledEval: evaluation failed. I fixed this problem with: but I don't understand why one way works and the other way doesn't. Both contexts (tree and documentElement) work with another XML document that does not use namespaces. Can anyone here enlighten me?
|
|