On Tue, 26 Feb 2002, Tom Oehser wrote:

> 
> Given a document:
> 
>       <one xmlns='asdf'><two three='four'></two></one>
> 
> Using the XPath:
> 
>       //*[name()='one']/two/@three
> 
> Which seems to mean to mean either that it should work or that it should fail 
>depending on which
> day I am reading the spec....  Is Xalan right, or is dom4j right?

A-ha!  dom4j/jaxen beats Xalan!  

We went 'round and 'round on this, and I think we're correct.

Your XPath is for elements not in a namespace, while your
document contains elements in a namespace.  The fact that
your document uses the default namespace mechanism is
irrelevant, as the XPath doesn't inherit *any* namespace
mappings from the document.

You need to bind a prefix to the namespace in a NamespaceContext
for your XPath, and then use that prefix.  There's no concept
of 'default namespace' rules in xpaths, so you have to be 
explicit about it.

Wacky, but true.

        -bob
        (surpised to learn Xalan is non-conformant)


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to