[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xml-dev] parsing of xml docs / XPath
- From: David Brownell <firstname.lastname@example.org>
- To: email@example.com, firstname.lastname@example.org
- Date: Fri, 12 Oct 2001 09:28:04 -0700
> Is it possible to ignore the doctype of an XML document in a way that I
> use a local DTD instead of the DTD that is mentioned in the doctype for
> parsing (using Xerces 1.4).
Any SAX parser supports the EntityResolver interface, which will
be used to get the text for external parsed entities such as the external
subset of the DTD. Just provide a resolver that returns your chosen
extenal subset instead of the one specified in the document (you won't
have that control over the internal subset), or ...
> I need this to modify an application in such a way that it reads the first
> XML file and loads the DTD mentioned in the doctype from the server to
> store it in the cache or on harddisc. All following files should than be
> validated against the local copy of the DTD (to lower net traffic).
... you actually want to provide a cache module, which will fetch the
entities if they're not already cached and will then return entities only
from the cache. Also easy to do with a custom EntityResolver.
If done right it'll even handle DTDs that consist of multiple entities.
(That's common ... even XHTML 1.0 has separate DTD modules for
things like standardized character entities.)
The tricky thing with caches is the policy of what stays cached.