[jdom-interest] resolving a PUBLIC dtd

Jason Hunter jhunter at acm.org
Tue Aug 7 11:04:51 PDT 2001


"Crook, Charles" wrote:
> 
> If the uploaded xml contains a PUBLIC dtd, such as:
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> 
> JDom's SAXBuilder throws an exception because of our corporate firewall,
> which requires a user id / password for outbound traffic:
>
> ...
>
> Or is there a JDom way around this?  I realize after some reading that I
> could disable DTD loading by using setEntityResolver, but in this case I
> will want to load the DTD and use it for validation because the application
> will be accepting XML files built by clients using our PUBLIC DTD.

Since you want validation, you need to provide the DTD somehow.  I'd
recommend setting an entity resolver which when it sees that public id
returns a local version of the DTD.

-jh-





More information about the jdom-interest mailing list