[jdom-interest] Re: Patches for JDOMSource and JDOMResult (was: Re: [jdom-interest] JDOMResult silently absorbs document fragments)

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Aug 22 01:36:15 PDT 2002

Markus Pallo wrote:
> i continued now my tests. It looks like xerces is unable to parse the 
> document fragment which is created in SAXOutputter dtdEvents(Document 
> document). Also caucho sax parser tells unable to parse Document.
> The root element is missing.

This is not an error: it was done on purpose. SAXOutputter builds a DTD string 
from the DocType found in the document and handed it to a parser for that 
parser to fire the DTD events. Of course, there is no root element because 
SAXOutputter will fired the SAX events related to the JDOM document just after 
the parser reported a SAXParseException. This exception is expected as shown 
by the comments in the catch() clause just after the call to 

What's weird in your case is that Xerces fires an IndexOutOfBoundException 
instead of the expected SAXParseException. Which version of Xerces are you 
using? Is your DTD file correct (i.e. parsed successfully by the same parser 
when directly referenced from an XML document)?


More information about the jdom-interest mailing list