[jdom-interest] bug in Element.getCopy ?

Jason Hunter jhunter at collab.net
Fri Mar 2 09:05:32 PST 2001


Jochen Strunk wrote:
> 
> At 18:11 01.03.2001 -0800, you wrote:
> >The name and namespace uniquely identify an element and are intrinsic to
> >that element.  Changing names or namespaces on a parent element should
> >not change names or namespaces of children.
> The XML namespace specification clearly states the following:
> A default namespace is considered to apply to the element where it is
> declared (if that element has no namespace prefix), and to all elements
> with no prefix within the content of that element.
> 
> That contradicts to what you are saying because "no namespace" is not
> intrinsic to an element, it changes in the context of a parent element with
> a default namespace. If you change the default namespace of an element you
> also have to change the namespace of all its child elements with "no
> namespace". This you don't do in jdom, since every element is created with
> an empty namespace. Its a difference between the empty namspace and "no
> namespace" and in jdom there currently is no such thing as "no namespace".

The namespace spec describes the textual representation, not the object
model.  I believe DOM behaves very similarly to JDOM in this area.  An
element object keeps its name and namespace (or lack of namespace) no
matter where you place it in a document.

-jh-



More information about the jdom-interest mailing list