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 "K.Kawaguchi" <kk...@kohsuke.org> on 2003/10/28 19:40:04 UTC

XMLEntityResolver question

XMLEntityResolver's javadoc says:

>     /**
>      * Resolves an external parsed entity. If the entity cannot be
>      * resolved, this method should return null.
>      *
>      * @param resourceIdentifier:  location of the XML resource to resolve
>      *
>      * @throws XNIException Thrown on general error.
>      * @throws IOException  Thrown if resolved entity stream cannot be
>      *                      opened or some other i/o error occurs.
>      * @see org.apache.xerces.xni.XMLResourceIdentifier
>      */
>     public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
>         throws XNIException, IOException;

To me, it's not quite clear when the method can return null.

In SAX EntityResolver, as you know, you can return null to have the
caller do the default entity resolution. But with XMLEntityResolver,
it's not clear if this is true.

Looking at the way EntityResolverWrapper is implemented, it seems to
believe that returning null will cause the caller to resolve the
resource normally.

However, with some other code like XMLSchemaLoader, this doesn't seem to
be the case and returning null will actually cause the resolution to
fail.

Which of those two is the correct behavior? If the former is the case,
is there any handy utility that can do the default resolution?

In any case, I think people would be benefited by clarifying javadoc.



regards,
----------------------
Kohsuke Kawaguchi
E-Mail: kk@kohsuke.org


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