[jdom-interest] Issue with Doctype (systemId , publicId whitespace)

Collin VanDyck collin at hannonhill.com
Tue May 11 05:08:54 PDT 2004


Laurent Bihanic wrote:

> This is a bug in SAXOutputter.
>
>> I saw a similar problem online:
>>
>> http://www.junlu.com/msg/49224.html
>
>
> This is exactly the same problem and a patch was proposed which also 
> applies to your JDOM version :
>  - Look for the method dtdEvents(Document document).
>    In the following code:
>                // No internal subset defined => Try to parse original DTD
>                if ((publicID != null) || (systemID != null)) {
>                     if (publicID != null) {
>                         buf.append(" PUBLIC ");
>                         buf.append('\"').append(publicID).append('\"');
>                     }
>                     else {
>                         buf.append(" SYSTEM ");
>                     }
>                     buf.append('\"').append(systemID).append('\"');
>                 }
>                 else {
>                     // Doctype is totally empty! => Skip parsing
>                     buf.setLength(0);
>                 }
>
>    Replace the lines:
>                         buf.append(" SYSTEM ");
>                     }
>                     buf.append('\"').append(systemID).append('\"');
>    by:
>                         buf.append(" SYSTEM");
>                     }
>                     buf.append(" \"").append(systemID).append('\"');
>
> For the "Fatal error" message display issue, you need to patch the 
> createDTDParser() method : Just before the return statement, at the 
> end of method, insert the following line :
>         parser.setErrorHandler(new DefaultHandler());
>
> Hope this helps,
>
> Laurent
>
>

Beautiful!

It will definitely help -- I am going to download the source and rebuild 
today.

Thanks, and thanks to all who replied. I'm grateful for your helpfulness.

Collin





More information about the jdom-interest mailing list