[jdom-interest] bug in Element.getCopy ?

Jochen Strunk strunk at signal7.de
Fri Mar 2 10:29:50 PST 2001


At 09:05 02.03.2001 -0800, you wrote:
>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.

Have you read my reply to Philip ? (I only cc'd to the list).
The point I'm trying to make is that jdom does not distinguish correctly 
between no namespace and the empty namespace. It looks like 
Namespace.NO_NAMESPACE falsely represents the empty namespace. That leads 
for example to wrong output by the XMLOutputter as I showed in the example. 
DOM Level 2 distinguishes between no namespace and empty namespace by 
requiring applications to use the null value for representing no namespace.

jochen



(-) Jochen Strunk
(-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
(-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665402, Fax: 06151 665373
(-) strunk at signal7.de, www.signal7.de




More information about the jdom-interest mailing list