commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: [Digester] How to turn off parse's attempt to retrieve dtd?
Date Wed, 15 Jun 2005 09:26:33 GMT
On Wed, 2005-06-15 at 11:12 +0200, Thomas Dudziak wrote:
> > (2) write a custom EntityResolver subclass that returns an empty stream
> > when asked for the DTD, and register that with Digester using
> > Digester.setEntityResolver.
> 
> Forrest and others use the xml-resolver component from
> http://xml.apache.org/commons/components/resolver/index.html, which
> provides such an entity resolver that is able to map system
> identifiers to (different) urls.
> Have a look at the "XML Entity and URI Resolvers" article
> (http://xml.apache.org/commons/components/resolver/resolver-article.html)
> for a more in-depth explanation.

Thanks for the links Tom - I knew that there were open-source
EntityResolver implementations that supported OASIS catalogs but didn't
know one was at Apache!

It should be noted, though, that writing a trivial EntityResolver to
simply ignore external entities is only about 10 lines, which might be
better than introducing an external dependency. Of course for more
flexibility the xml.apache.org classes look to be the way to go..

However ignoring the DTD can potentially change the meaning of a
document, and so should only be done when the DTD is known to have
nothing but validation rules in it.

Cheers,

Simn


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message