This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
xpathapi question
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] xpathapi question
- From: "Sanjay Pandey/Towers Perrin" <pandeys at towers dot com>
- Date: Thu, 11 Oct 2001 10:46:53 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi List,
I have a Schema as follows
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.x.com/x" xmlns
="http://www.w3.org/2001/XMLSchema" xmlns:x="http://www.x.com/x"
elementFormDefault="qualified">
<!-- XYZ Info -->
<element name="XYZ" type="x:XYZ"/>
<complexType name="XYZ">
<sequence>
<element name="x" type="string"/>
<element name="y" type="double"/>
<element name="y" type="date"/>
</sequence>
</complexType>
</schema>
I am reading this XSD using DocumentBuilderFactory
(javax.xml.parsers.DocumentBuilderFactory)
I have had no problem using XPathAPI Java function for various purposes on
XML data, but when I use XPathAPI on this XSD (Schema), I am not getting
any result back.
I want to get the "element" node with @name="x" ( and then I would go on to
get the "type" info ...) .
XObject obj = null;
String result = null;
obj = XPathAPI.eval(rootNode,"//element[@name
= 'x']",rootNode);
result = obj.toString();
obj = XPathAPI.eval(rootNode,"//x:element[@name
= 'x']",rootNode);
result = obj.toString();
obj = XPathAPI.eval(rootNode,"//element[@name = 'x']");
result = obj.toString();
obj = XPathAPI.eval(rootNode,"//x:element[@name = 'x']");
result = obj.toString();
I do not get anything from "result".
What am I missing? Some NameSpace kind of issue or what?
Thanks in advance,
Sanjay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list