[jdom-interest] DOMOutputter + DocType

Cybernd cybernd at cybernd.at
Mon Feb 16 04:27:35 PST 2004


Hi

Is there some kind of problem with the DOMOutputter, when the given JDom 
Document contains a DocType definition?

Code to test the behavior:
            DocType docType = new DocType("test", "test", "dummyExample");
            Element root = new Element("test");
            Document doc = new Document(root);
            doc.setDocType(docType);
            DOMOutputter domout = new DOMOutputter();
            org.w3c.dom.Document dom = domout.output(doc);

org.jdom.JDOMException: Exception outputting Document: Document 
contained top-level content with type:org.jdom.DocType
The exception is thrown in 
org.jdom.output.DOMOutputter.output(DOMOutputter.java:165)

It seems like the output(Document document) method creates a correct  
dom document with the given DocType, but after it the contentIterator 
does not allow such DocType definition.

Is it a jdom Bug? (Or is it my fault? Its the first time i try to use 
docTypes)

Regards
Neuhauser Bernhard



More information about the jdom-interest mailing list