Easy XPath Question for iPhone

Hey guys! It drives me crazy! 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. I am using TouchXML on the iPhone, and here is my xPath request:

/container/rootfiles/rootfile

This does not work! I tried everything. Any help would be appreciated ... Sam

+3
source share
2 answers

This bit xmlnsin containernode is the namespace prefix your query register may have.

I don’t know TouchXML well enough to say what a solution is, but an appropriate challenge libxml2 xmlXPathRegisterNs()if you go into the interior of TouchXML.

SO- TouchXML .

+2

TouchXML, .

XPath.

:

/*[name()='container']/*[name()='rootfiles']/*[name()='rootfile']
+1

Source: https://habr.com/ru/post/1743582/


All Articles