<html>
I've been loading XML documents (with Namespaces defined) and running
XPath queries over them.<br>
I've not been able to make the XPath queries return the correct nodes,
until I've stripped out the namespace references before loading the file
(ie the namespace.prefix and namespace.uri members for the Elements are
&quot;&quot;).&nbsp; I then reset them recursively with&nbsp;
Element.setNamespace(Namespace ns);<br><br>
I downloaded the jaxen libs and tried their samples, which use
web.xml&nbsp; as an input file. <br>
The XPath bits worked fine until I added a Namespace to 
web.xml.<br><br>
I tried XPath.addNamespace() but without any joy, eg following retuns 0
items in List:<br>
<tt>Namespace
ns=Namespace.getNamespace(&quot;<a href="http://www.xxxx.com/envelope" eudora="autourl">http://www.xxxx.com/envelope</a>&quot;);<br>
XPath xp = XPath.newInstance(&quot;/TopLevElement&quot;);<br>
xp.addNamespace(ns);<br>
List xlist = xp.selectNodes(tdoc);<br><br>
</tt>Looking at an Element of this example,
.namespace.prexif=&quot;&quot; and
.namespace.uri=&quot;<a href="http://www.xxxx.com/envelope" eudora="autourl">http://www.xxxx.com/envelope</a>&quot;,
so it looks like there should be a match.<br><br>
Can anyone provide some sample code to do XPath in the presence of
non-empty Namespaces?<br>
thanks<br>
Jon<br><br>
<x-sigsep><p></x-sigsep>
Jon Sharp&nbsp;&nbsp;&nbsp; tel: +44 1273 504004&nbsp;&nbsp;&nbsp;
mobile: +44 7739 430793 <br>
</html>