[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Java XPathAPI and namespace resolution related questio
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
|
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
|