Name
EntityResolver
Synopsis
An application can implement this interface
to help the parser resolve external entities, if required. If you
pass an EntityResolver
instance to the
setEntityResolver( )
method of an
XMLReader
, then the parser will call the
resolveEntity( )
method whenever it needs to read
an external entity. This method should use the public identifier or
system identifier to return an InputSource
that
the parser can use to read the content of the external entity. If the
external entity includes a valid system identifier, then the parser
can read it directly without the need for an
EntityResolver
, but this interface is still useful
for mapping network URLs to locally cached copies, or for mapping
public identifiers to local files, for example. The helper class
org.xml.sax.helpers.DefaultHandler
includes a stub
implementation of this interface, so if you subclass
DefaultHandler
you can override its
resolveEntity( )
method.
public interface EntityResolver { // Public Instance Methods InputSource resolveEntity(String publicId, String systemId) throws SAXException, java.io.IOException; }
Implementations
HandlerBase
,
org.xml.sax.ext.EntityResolver2
,
org.xml.sax.helpers.DefaultHandler
,
org.xml.sax.helpers.XMLFilterImpl
Passed To
javax.xml.parsers.DocumentBuilder.setEntityResolver(
)
, Parser.setEntityResolver( )
,
XMLReader.setEntityResolver( )
,
org.xml.sax.helpers.ParserAdapter.setEntityResolver(
)
,
org.xml.sax.helpers.XMLFilterImpl.setEntityResolver(
)
,
org.xml.sax.helpers.XMLReaderAdapter.setEntityResolver( ...
Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.