>Given when an entityResolver is called (at entity resolution time or, in
the schema world, at >grammar-resolution time), how would one be used to
cache an instance document?

In XML terms, the main instance document is also an Entity (XML REC 4.8,
"Document Entity"), so the EntityResolver theoretically can and should get
involved there just as it does for DTDs, external parsed entities, and -- I
would expect, since they're XML documents in their own right -- schemas.

Of course that only applies if you're retrieving the document via its
public/system IDs; if you explicitly pass in a stream or buffer, you're
past the point where the resolver can have any useful effect.

> Is the EntityResolver supposed to throw a SAXException when it finds a
likely-looking
>DOCTYPE decl?

I'm not sure what you're asking here... The EntityResolver should be
invoked when the parser knows which entity it wants to load, and has the
responsibility for saying "here's what that request really means, in our
environment."

Xerces users have fairly often used that to say "no, don't deliver the DTD
that was requested; deliver an empty one instead", which can be thought of
as a deliberately broken cache. The step from there to saying "No, don't
retrieve it from the net; retrieve it from my own buffers instead since
they already contain a current copy of this data" is a small one.


Of course an application may want to cache the fully-parsed document as a
DOM, or as whatever representation it's using, instead of or as well as
this entity-level cache. But there's definitely room in the architecture
for buffering at the entity level, if that suits the user's needs.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to