Title: Message
Alternatively, you can provide an EntityResolver that will resolve the SystemId (the URI) of the DTD to a copy on the local filesystem of the parsing application. 
 
In general, even a non-validating XML parser is supposed to read the DTD to supply default values for attributes and to expand entity references.  Without the latter, the document may not appear to be well-formed, or be missing very large pieces.  If you know that the documents and DTD in question preclude the need to read the DTD, you can skip it as Rahul suggested.
 
Jeff
----- Original Message -----
Sent: Tuesday, April 15, 2003 3:30 AM
Subject: RE: DTD access over the internet

Hi Christian,
 
Set an EntityResolver to the parser, and return a null from within resolveEntity() method, for the URI that you wish to ignore.
 
Cheers,
Rahul.
 
 
-----Original Message-----
From: Christian Lebaudy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 15, 2003 2:02 PM
To: [EMAIL PROTECTED]
Subject: DTD access over the internet



 
Hello, i am having trouble to parse a very simple document that has a <!DOCTYPE section with an http link over the internet.
I do not want to acces internet
I do not want to have to cut the XML file to get the DOCTYPE section out of it
I simply want to parse the document.
 
I am using :             DOMParser parser = new DOMParser();
 
I try following features but the java application want always to open a connection to the internet :
 
                // deactivating parser XML-DTD validation
                parser.setFeature("http://xml.org/sax/features/validation",false);
                // deactivating Xerces SAX parser DTD-file definition load
                parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
                // deactivating Xerces SAX parser grammar DTD-file definition load
                parser.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar",false);
                parser.setFeature("http://apache.org/xml/features/validation/schema",false);
                parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",false);
                parser.setFeature("http://apache.org/xml/features/validation/dynamic",false);
                parser.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",new File(".").getCanonicalPath());
I did not thought that i should have an internet connection to parse a document.
Does anyone knows how to tell to Xerces that I only want to parse a local document ?
 
thanks in advance

Reply via email to