[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Java XPathAPI and namespace resolution related questio

Subject: Java XPathAPI and namespace resolution related question
From: "Sanjay Pandey/Towers Perrin" <pandeys@xxxxxxxxxx>
Date: Fri, 9 Nov 2001 12:00:04 -0500
xpathapi namespace
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.