I believe the best way to deal with this would be to create your own EntityResolver and set this in the domFactory. Then you can pass back a local pointer to the DTD. If you don't want to validate, then you can just set the validation feature to false, and I don't think the parser will even look for the DTD.
 
John
-----Original Message-----
From: I�igo Serrano [mailto:[EMAIL PROTECTED]
Sent: 13 June 2002 10:25
To: [EMAIL PROTECTED]
Subject: Problem parsing a XML document

I have a problem reading a XML document. The problem is that the parser tries to connect to the server that is indicated in the Doctype.
The XML document is this (Struts-config.xml)
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
 
The code to read it is this
 
     DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
            domFactory.setValidating(false);
            DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
            File fichero=new File("url");
            return domBuilder.parse(fichero);
 
And then the parser (Xerces using JAXP) tries to access jakarta.apache.org
 
How can i solve it?
 
Thank in advance
 
I�igo Serrano
-------------------------------------
http://www.inigoserrano.com
http://isvalidator.sourceforge.net

The information transmitted by this e-mail message is intended solely for the use of the person to whom or entity to which it is addressed. The message may contain information that is privileged and confidential. Disclosure, dissemination, distribution, review, retransmission to, other use of or taking any action in reliance upon this information by anyone other than the intended recipient is prohibited. If you are not the intended recipient, please do not disseminate, distribute or copy this communication, by e-mail or otherwise. Instead, please notify us immediately by return e-mail (including the original message with your reply) and then delete and discard all copies of the message.


Although we have taken precautions to minimize the risk of transmitting viruses we nevertheless advise you to carry out your own virus checks on any attachment to this message. We accept no liability for any loss or damage caused by viruses.

Reply via email to