This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]