[jdom-interest] bug in Element.getCopy ?

GB/DEV - Philip Nelson philip.nelson at omniresources.com
Fri Mar 2 06:46:21 PST 2001


> 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".

Please help me understand this.  All elements in JDOM are created with
either the namespace, namespace + prefix you supply or the NO_NAMESPACE
namespace which is
prefix = "", uri="";

By your definition above, a default namespace is required for it to apply to
child elements with matching prefixes or no prefixes so...

<element xmlns="http://foo">
	<child1 />
	<child2 />
<element> 

would fit your scenario but in the defaul case with the NO_NAMESPACE
namespace
<element>
	<child1 />
	<child2 />
<element> 

has no default namespace so changing the namespace of <element> would not
imply a change to the children, correct?  

What I would like is concrete examples so I can write tests to confirm what
is supposed to be happening.



More information about the jdom-interest mailing list