|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xpathapi question
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








