Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Xalan-j XPathAPI and namespaces

From: Dino Morelli <dino.morelli@----.---.------->
To: NULL
Date: 11/3/2003 7:45:00 PM
Looking for someone familiar with Xalan-j..

I'm having problems isolating a node in a Document with Xalan-j's
XPathAPI class when that element is in a namespace.

using:
Xalan-j v2.5.1
JDK v1.4.2-b28

Given an XML document that looks like this:

<a xmlns:foo="foo-ns">
   <b>value 1</b>
   <foo:b>value 2</foo:b>
</a>

These calls return null:

// Document doc contains the parsed above document
Node n = XPathAPI.selectSingleNode(doc, "/a/foo:b");
Node n = XPathAPI.selectSingleNode(doc, "/a/foo:b",
   doc.getDocumentElement());

However, this xpath works, retrieving the second b with no namespace
explicitly requested:

"/a/b[2]"


Does anyone know how to make the first type of xpath "/a/food:b" work?


-- 
Dino Morelli  dino.morelli@s...       .~.
http://www.debian.org  Debian GNU/Linux   /V                                         /( )                                         ^^-^^


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent