edu.emory.mathcs.util.xml
Class DTDResolver

java.lang.Object
  extended byedu.emory.mathcs.util.xml.DTDResolver
All Implemented Interfaces:
org.xml.sax.EntityResolver

public class DTDResolver
extends java.lang.Object
implements org.xml.sax.EntityResolver

SAX entity resolver that associates public IDs to URLs of their appropriate DTD specifications. For example, DTD may be stored in a JAR file (as a resource); then, the URL of the DTD will be the JAR URL pointing to that resource. When the SAX parser encounters XML document with this public ID, it will be able to resolve and load the DTD, and then validate the document.

Version:
1.0
Author:
Dawid Kurzyniec

Constructor Summary
DTDResolver()
          Creates a new DTD resolver with no ID to URL associations.
DTDResolver(java.lang.String pubID, java.net.URL dtdUrl)
          Creates a new DTD resolver with the specified ID to URL association.
 
Method Summary
 void addMapping(java.lang.String pubID, java.net.URL dtdUrl)
          Adds a specified ID to URL association to the mapping.
 org.xml.sax.InputSource resolveEntity(java.lang.String pubID, java.lang.String sysID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTDResolver

public DTDResolver()
Creates a new DTD resolver with no ID to URL associations.


DTDResolver

public DTDResolver(java.lang.String pubID,
                   java.net.URL dtdUrl)
Creates a new DTD resolver with the specified ID to URL association.

Parameters:
pubID - the public ID
dtdUrl - the URL of the DTD associated with that public ID
Method Detail

addMapping

public void addMapping(java.lang.String pubID,
                       java.net.URL dtdUrl)
Adds a specified ID to URL association to the mapping.

Parameters:
pubID - the public ID
dtdUrl - the URL of the DTD associated with that public ID

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String pubID,
                                             java.lang.String sysID)
                                      throws org.xml.sax.SAXException
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException