This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Java XPathAPI and namespace resolution related question
- To: XSL-List at lists dot mulberrytech dot com
- Subject: [xsl] Java XPathAPI and namespace resolution related question
- From: "Sanjay Pandey/Towers Perrin" <pandeys at towers dot com>
- Date: Fri, 9 Nov 2001 12:00:04 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi List,
We moved to a newer version of our Java Application Server and the code
which was working earlier is not working anymore. I believe it must be
"namespace" related.
My xml looks like
<root xmlns="http://x.com/rootMeta" xmlns:xsi
="http://www.w3.org/2000/10/XMLSchema-instance" xsi:schemaLocation
="x.com/xyz.xsd">
<element name="XY">
<details>XY details</details>
</element>
.
.
.
</root>
In my Java code now I am adding namespace prefix info (e.g. xs:)
(here the rootNode is obtained by loading the XML as Document and getting
the Node by getDocumentElement())
xpathStr = "//xs"+element+"[@name='XY']";
PrefixResolver prefixResolver = new MyPrefixResolver(rootNode);
XObject xobj = XPathAPI.eval(rootNode,xpathStr,prefixResolver);
nl = xobj.nodelist();
MyPrefixResolver has
public String getNamespaceForPrefix(String prefix){
String ns = "http://x.com/rootMeta";
return ns;
}
I am not getting any nodes back in NodeList (nl). I have verified by some
other means and it does not seem to be a data issue.
I must be missing something. Any help would be appreciated.
Thanks,
Sanjay
215-246-4771
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list