[jdom-interest] output with namespace only on root element
tballen at copart.com
tballen at copart.com
Mon Jun 9 07:26:33 PDT 2003
Hello.
I am constructing a JDOM document in the "cprt" namespace.
I only want the root element to show this namespace and have all child
elements inherit the "cprt" namespace by default.
I want the doc. to be output like this:
<cprt:root>
<elrm1>text1</elem1>
<e;em2>text2</elem2>
</cprt:root>
I create the document as follows:
root = new Element(ROOT, cprt);
doc = new Document(root);
...
Element element = new Element(elementName, cprt);
element.addContent(formatDate(returnObj.toString()));
parent.addContent(element);
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.
Thanks.
More information about the jdom-interest
mailing list