implements EntityResolver : EntityResolver « org.xml.sax « Java by API






implements EntityResolver

  
import org.xml.sax.EntityResolver;

import java.io.IOException;

import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class SimpleEntityResolver implements EntityResolver {

  private static final String USAGE_TERMS_ID = "http://www.n.com/t.xml";

  private static final String USAGE_TERMS_LOCAL_URI = "C:\\t.xml";

  public InputSource resolveEntity(String publicID, String systemID) throws IOException,
      SAXException {

    if (systemID.equals(USAGE_TERMS_ID)) {
      return new InputSource(USAGE_TERMS_LOCAL_URI);
    }

    return null;
  }

}

   
    
  








Related examples in the same category