> So Bob - I'm trying to read through the specs to figure out why I can't
> refer to an element using the prefix. The org.w3c.dom.Element.getName()
> method doesn't change when I declare a namespace; in this case, it still
> returns "xs:element". 

Yah.  I'm not familiar with DOM itself, but there are (or should be) several
methods.

        getName() -> "xs:element"

        getLocalName() -> "element"

        getNamespacePrefix() -> "xs"

        getNamespaceUri() -> "foo"

XPath doesn't use the getName() [possibly called getQName()], but rather
the getLocalName() and getNamespaceUri().

XPath is based upon what the element truly *is*, not how it is named.

        <xs:element xmlns:xs="foo"/>

        <cheese:element xmlns:cheese="foo"/>

In this case, both elements are semantically equivalent. They are named
differently, but they are both "element" elements in the "foo" namespace.

You could write an XPath of:

        bob:element

and bind "bob"->"foo", and that XPath would match both of the above
elements.  Because, through the mapping, the XPath refers to an "element"
element in the "foo" namespace.  Prefixes be damned.

Confusing? Yes. Conformant to the spec?  Yes.

        -bob


_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to