[jdom-interest] empty xmlns

Elliotte Rusty Harold elharo at metalab.unc.edu
Fri Jan 9 06:08:59 PST 2004


At 9:59 AM +0000 1/9/04, <christopher.faulkner at ntlworld.com> wrote:


>When I create MyFavourite with the Element constructor, I am not 
>adding a Namespace or any type of attribute so why is it there ?


That's exactly why it's there. You created an element that is in no 
namespace. Because the parent element is in a namespace, the 
serializer must add xmlns="" to the child element to prevent it from 
inheriting the default namespace of its parent. If you don't want the 
child to be in a namespace, this is correct. If you do want the child 
element to be in a namespace, you need to specify this namespace URI 
in the Element constructor.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the jdom-interest mailing list