Here is my XML document:
<?xml version="1.0" encoding="UTF-8"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
<rootfile full-path="content.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
All I want to do is get the root file element. I’m using TouchXML on the iPhone and here is my xPath query:
/container/rootfiles/rootfile
It doesn’t work! I’ve tried everything.
That
xmlnsbit within thecontainernode is a namespace prefix that you may have your query register.I don’t know TouchXML well enough to say what the solution is, but the relevant
libxml2call isxmlXPathRegisterNs()if you go into the innards of TouchXML.This SO answer might also help point you to the right TouchXML method to use to register this namespace.