[jdom-interest] Namespace inheritance after cloning

Elliotte Harold elharo at metalab.unc.edu
Mon Nov 29 10:37:53 PST 2004


Phil Weighill-Smith wrote:

> Risking a flame or two, the approach we took as to provide an external 
> "clone" mechanism that could generate a copy of a (part of a) JDOM node 
> tree, modifying all the namespaces for the elements in that tree to a 
> namespace passed into the mechanism. This allows you to do what you want 
> without getting into the question of modifying JDOM's source to behave 
> in a non-XML-consistent manner.
> 

Changing the namespace is fine, if you know you want to do that, and 
make an explicit decision to do so. For instance, I can imagine reading 
in a well-formed HTML document and moving every element into the XHTML 
namespace (though if that's what you want to do, you're probably better 
off using TagSoup in the first place.) However, it shouldn't happen by 
default just because an element moves from point A to point B.

-- 
Elliotte Rusty Harold  elharo at metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim


More information about the jdom-interest mailing list