[jdom-interest] resolving a PUBLIC dtd

Crook, Charles CrookC at tvratings.com
Wed Aug 1 09:16:37 PDT 2001


Using Weblogic 6.0sp2 and JDom b-7, we're using this to process an XML file
which has been uploaded.

   SAXBuilder saxBuilder = new SAXBuilder( parserClass, false ) ;
   Document xmlTempDoc = saxBuilder.build( new StringReader( sXml ));

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:

org.jdom.JDOMException: Error in building: Tried all: '1' addresses, but
could not connect over HTTP to server: 'java.sun.com', port: '80'
org.jdom.JDOMException: Error in building: Tried all: '1' addresses, but
could not connect over HTTP to server: 'java.sun.com', port: '80'
 at org.jdom.input.SAXBuilder.build(SAXBuilder.java:306)
 at org.jdom.input.SAXBuilder.build(SAXBuilder.java:650)

Is this something that our network staff will have to solve to allow a
specific user to travel through the firewall without a
userid/password?

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.

Charlie Crook







More information about the jdom-interest mailing list