[jdom-interest] Re: unwanted namespace attributes

Michael Kay mike at saxonica.com
Tue Oct 17 08:22:51 PDT 2006


> It is 
> extremely important for me to obtain _exactly_ the same tree 
> I have read as input.
> 

That surely is the point: you want the same tree, not the same lexical XML.
In the source tree, the element contained an in-scope namespace binding the
prefix BODY to the namespace URI [whatever]. Therefore, the result tree also
needs to contain such a binding.

You should think of namespace declarations as being implicitly copied by the
parser/tree builder to all descendant elements. The serializer will remove
namespace declarations if they are redundant (that is, if there is a parent
element that has the declaration).

Michael Kay
http://www.saxonica.com/



More information about the jdom-interest mailing list