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

tballen at copart.com tballen at copart.com
Mon Jun 9 08:04:40 PDT 2003


I guess I did not phrase my question properly.
The child elements *are* in the same namespace since the parent element is 
in the default namespace.  (At least I think so.)
Here is the complete root element:
<cprt:root xmlns:cprt="http://www.myserver.com/schema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.myserver.com/schema 
http://www.myserver.com/schema/schemadoc.xsd">
...
</cprt:root>

Thanks.


At 10:41 AM 6/9/2003 -0400, you wrote:

>>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