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 Andy Clark <an...@apache.org> on 2000/07/01 00:00:27 UTC

Re: BUG: setEntityResolver doesn't work with DOM

Norman Walsh wrote:
> |   1) entity resolver returns null
> 
> I see only one reasonable interpretation, resolution failed and the
> original system identifier should be used.

That's easy enough.

> |   2) entity resolver returns input source
> |      a) with only system id set
> 
> Open and use that system identifier.

With the restriction that the system identifier MUST be absolute.
That's a clarification that I would agree with and implement.

> | However, in your entity resolvers, you should either follow 1
> | or 2.d - 2.e, never anything in between. When you return a non-
> | null input source from the resolveEntity method, you are (now)
> | making a contract with the parser that you are opening the
> | stream to the entity (hence the "throws IOException" in the
> | interface).
> 
> Yes, that's the conclusion I reached as well, but I'd really like to
> see this fixed (if we agree it's a bug :-). I'd like to be able to
> return an absolute URI so that the resolver didn't have to get into
> opening documents. That's not really the resolver's job, IMHO. The

Well I would disagree with you here. Entity resolvers can and do
return open streams. If your entity resolvers don't open files,
though, no big deal.

A very common performance enhancement to XML applications is to
pre-load the grammar files into memory and then use the entity
resolver to read from the in-memory buffer.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org