[jdom-interest] Two namespace-questions (revisited)
Michael Kay
mike at saxonica.com
Thu Jun 7 06:21:09 PDT 2007
> Thanks - this did the biggest part of the trick - I can now
> use XPath-Strings the same way I can do it in other software.
As a matter of interest, what is this "other software" (which seems not to
follow the XPath specification)? It seems to have had the classic effect
that happens when you don't follow standards - your users get extremely
confused when they encounter other products behaving in different ways.
> The returned elements still contain a
>
> xmlns="http://www.tei-c.org/ns/1.0"
>
> that they don't have in the original document, tho.
I think they *do* have it in the original document - in the sense that an
element "has" not only its own namespace declarations but all the namespace
declarations on its ancestors. When you take an element out of its parental
context, you don't typically want it to move to a different namespace as a
side-effect.
To put it another way, in the XPath data model the following two documents
are equivalent
(1) <a xmlns="z"><b/></a>
(2) <a xmlns="z"><b xmlns="z"/></a>
(the first is just a shorthand for the second), and you wouldn't want //b to
give different results for the two cases.
Michael Kay
http://www.saxonica.com/
More information about the jdom-interest
mailing list