Hi All,

 

I had always thought that by simply using a non-validating parser I could avoid the overhead of fetching the remote dtd and such. But it seems that it is still being resolved and fetched even though I am using a non-validating parser. If I parse a web.xml with the following DOCTYPE with no internet connection I get the following error, I don’t know why it should be ignoring it???

 

<!DOCTYPE web-app

  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"

  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

 

Error thrown:

 

java.net.UnknownHostException: java.sun.com

            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:153)

            at java.net.Socket.connect(Socket.java:452)

            at java.net.Socket.connect(Socket.java:402)

            at sun.net.NetworkClient.doConnect(NetworkClient.java:139)

            at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)

            at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)

            at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)

            at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)

            at sun.net.www.http.HttpClient.New(HttpClient.java:339)

            at sun.net.www.http.HttpClient.New(HttpClient.java:320)

            at sun.net.www.http.HttpClient.New(HttpClient.java:315)

            at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:512)

            at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:489)

            at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:617)

            at java.net.URL.openStream(URL.java:913)

            at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:731)

            at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:691)

            at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:258)

            at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:811)

            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)

            at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:525)

            at org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:581)

            at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)

            at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:221)

            at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:209)

            at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:151)

 

As you can see the parser is trying to make a connection to the remote dtd host even though it is a non-validating parser?

 

How can I disable this without removing or altering the DOCTYPE?

 

Thanks,

 

Greg Hess

Software Engineer

Wrapped Apps Corporation

275 Michael Cowpland Dr.

Suite 201

Ottawa, Ontario

K2M 2G2

Tel: (613) 591 -7552 ext 230

Fax: (613) 591-0523

1 (877) 388-6742

www.wrappedapps.com

 

<<image001.gif>>

Reply via email to