You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Rick Bullotta <ri...@lighthammer.com> on 2002/06/18 23:00:38 UTC

RE: Suppressing DTD Defaults Processing with Xerces/JAXP interface

Got an answer:

Add a dummy EntityResolver that bypasses DTD processing as in:

private class DummyResolver implements EntityResolver {

   public InputSource resolveEntity(String publicID, String systemID) throws
IOException, SAXException {
        return( new InputSource(new StringReader("")));
    }

}


Then, set the DocumentBuilder object's resolver to this one instead, as in:

dBuilder.setEntityResolver(new DummyResolver());

Voila!  Success!

Rick Bullotta
CTO
Lighthammer Software (www.lighthammer.com)


-----Original Message-----
From: Rick Bullotta [mailto:rick.bullotta@lighthammer.com]
Sent: Tuesday, June 18, 2002 12:13 PM
To: xerces-j-user@xml.apache.org
Cc: xerces-j-dev@xml.apache.org
Subject: Suppressing DTD Defaults Processing with Xerces/JAXP interface


Given a document:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE iChart SYSTEM "http://localhost/Illuminator/DTD/iChart.dtd">
<iChart SaveDate="06/18/2002 11:39:06" Version="9.0"
ChartBorderColor="#FFFF00" MainBorderColor="#FF0000"/>

...and the following code:

DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
dFactory.setValidating(false);
dFactory.setExpandEntityReferences(false);
DocumentBuilder dBuilder = dFactory.newDocumentBuilder();

Document doc = dBuilder.parse(iStrm);


...I would expect that the DTD not be processed.  However, there are
defaults defined in the DTD that are included in the resultant DOM.

How can this be suppressed with Xerces?

We are running Xerces 1.4.4, because of issues with Xalan compatibility.

Rick Bullotta
CTO
Lighthammer Software (www.lighthammer.com)


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org