[jdom-interest] newbie question
laurent.bihanic at atosorigin.com
Mon Dec 9 07:46:22 PST 2002
bob mcwhirter wrote:
> That seems like a massive mis-use of namespaces and prefix bindings.
> The prefixes in an XPath are in no way related to the prefixes used in
> a document. The theory is that a user should be able to write:
> and denote that "goober" maps to "urn:xyz:abc" and still select the
> correct nodes from the document, regardless of the doc's own prefix->uri
As a programmer, I agree with you. Now, imagine a user typing an XPath
expression after having selected a node or, in a script written in XML, as the
value of an attribute of a node. How would you expect the guy to understand
you do not automatically recognize the namespace prefix defined 2 nodes higher
up in the hierarchy ?
Maybe this is a very specific use-case but it is truly a case where one needs
automatic namespace resolution. Hence the NamespaceContext implementation.
And adding to the XPath object all the namespaces declared from the node up to
the document root is quite cumbersome.
> Would an ignoreNamespaces(boolean) satisfy your needs better?
No, I'm fine with namespaces. I just need to provide a user-friendly way to
deal with them.
More information about the jdom-interest