EntityResolver

Allows to resolve external entities based on SYSTEM or PUBLIC ids.

  • Resolves the external entity identified by the publicId and systemId parameters.

    InputSource resolveEntity( String publicId, String systemId) 
  • Allows the application to resolve the external entity to a different InputSource. (http://www.test.org/test.dtd -> test.dtd)

    import org.xml.sax.EntityResolver;
    import org.xml.sax.InputSource;
    
    public class LocalResolver implements EntityResolver 
      public InputSource resolveEntity( String publicId, String systemId) {
        if ( systemId.equals( "http://www.test.org/test.dtd")) {
          return new InputSource( "test.dtd");
        } else {
          return null;
        }
      }
    }