Name

The EntityResolver2 Interface

Synopsis

SAX 2.0.2 adds an EntityResolver2 subclass of EntityResolver that provides extra methods for more flexible entity resolution. In particular, it lets a program provide an external DTD subset for a document that does not have a document type declaration. It also lets entities be resolved based on the root element name and base URL, as well as the public ID and system ID. Your code can always pass an EntityResolver2 object to setEntityResolver( ). A parser that does not supports EntityResolver2 will simply ignore the extra methods. The http://xml.org/sax/features/use-entity-resolver2 feature tells you whether the parser will use the extra methods in EntityResolver2.

package org.xml.sax.ext;
     
public interface EntityResolver2 {
     
  public InputSource getExternalSubset(String name, String baseURI);
  public InputSource resolveEntity(
    String name, String publicID, String baseURI, String systemID);
     
}

Get XML in a Nutshell, 3rd 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.