[jdom-interest] XPath and Namespaces

bob mcwhirter bob at werken.com
Fri Jul 26 05:59:48 PDT 2002


On Fri, 26 Jul 2002, Laurent Bihanic wrote:

>  From the Javadoc of Jaxen's NamespaceContext: "In XPath, there is no such 
> thing as a 'default namespace'. The empty prefix *always* resolves to the 
> empty namespace URI."
> 
> I haven't verified against the XPath spec but this clearly indicates you can't 
> use "" as namespace prefix in XPath.
> You should fill a bug against Jaxen requesting XPath.addNamespace to throw an 
> exception if the passed namespace prefix is empty.

It's a PITA, sure, but it is indeed compliant, as we read the spec.

I can see why it's that way (so that xpaths can truly be independent from
the document they are applied to), but it does trip folks up a lot.

	-bob




More information about the jdom-interest mailing list