You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Greg Hess <gh...@wrappedapps.com> on 2004/05/03 15:51:24 UTC
DTD being resolved using non-validating parser?
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(HttpURLConnecti
on.java:512)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.ja
va:489)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
tion.java:617)
at java.net.URL.openStream(URL.java:913)
at
org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.jav
a:731)
at
org.apache.xerces.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.
java:691)
at
org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImp
l.java:258)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XML
DocumentScannerImpl.java:811)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo
cumentFragmentScannerImpl.java:333)
at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPars
erConfiguration.java:525)
at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPars
erConfiguration.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.jav
a: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
<http://www.wrappedapps.com>
Re: DTD being resolved using non-validating parser?
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
What 'non-validating' means is already described as an FAQ [1] on the
website.
[1] http://xml.apache.org/xerces2-j/faq-write.html#faq-2
Joseph Kesselman <ke...@us.ibm.com> wrote on 05/03/2004 01:46:02 PM:
>
>
>
>
> This should probably be added to the FAQ page of the website, y'know...
>
> ______________________________________
> Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
> "The world changed profoundly and unpredictably the day Tim Berners Lee
> got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
Re: DTD being resolved using non-validating parser?
Posted by Joseph Kesselman <ke...@us.ibm.com>.
This should probably be added to the FAQ page of the website, y'know...
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: DTD being resolved using non-validating parser?
Posted by Andy Clark <an...@apache.org>.
Greg Hess wrote:
> 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
Nope. Even if a parser is non-validating, it must do things
like normalize attribute values according to their type. It
can't do this without reading the DTD declarations.
However, there are Xerces-specific features that you can
set that will prevent the external DTD from being fetched
and processed. Specifically, you want the feature:
http://apache.org/xml/features/nonvalidating/load-external-dtd
Please refer to the Features page in the documentation for
information.
--
Andy Clark * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org