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]

Java XPathAPI and namespace resolution related question



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


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