I have an XML file that looks like this:
<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jr="http://openrosa.org/javarosa">
<h:head>
<h:title>Widgets</h:title>
<model>
<itext>
</itext>
<instance>
<widgets xmlns="widgets">
</widgets>
</instance>
</model>
</h:head>
<h:body>
</h:body>
</h:html>
I am able to successfully load the file and most things that I have
tried thus far have tried work fine however I am having trouble running
the following code.
String instanceChild =
mForm.gotoTag("h:head/model/instance").gotoChild().getCurrentTagName();
From what I understand this should give me the string "widgets" however
instead I am getting an exception that reads
10-21 09:13:44.463: ERROR/AndroidRuntime(2202): Caused by:
com.mycila.xmltool.XMLDocumentException: Error executing xpath
'h:head/model/instance' from node 'h:html': Inexisting target node.
I would really appreciate if someone could tell me what I'm doing wrong
here. Whatever it is it isn't apparent to me.
Thanks in advance,
Matt
> You must always use namepsaces in your xpath expressions (this
> limitation commes from the jdk w3c implementation).
Thanks, Mathieu. Your explanation helped.
Cheers,
Matt