[jdom-interest] output with namespace only on root element

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Jun 9 07:41:51 PDT 2003


>When I use XMLOutputter to output the document all elements have the 
>"cprt" namespace prefix but I only want the root element to show 
>this.
>Is this possible?
>I guess I could add all child elements without a namespace but then 
>the JDOM document would not be accurate.

You misunderstand namespaces. Unprefixed child elements are *not* in 
the same namespace as their parent element unless the default 
namespace is the same as the namespace of the parent element.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Processing XML with Java (Addison-Wesley, 2002)
   http://www.cafeconleche.org/books/xmljava
   http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA



More information about the jdom-interest mailing list