com.ibm.commerce.contract.util

Class XMLEntityResolver

  • java.lang.Object
    • com.ibm.commerce.contract.util.XMLEntityResolver
  • All Implemented Interfaces:
    org.xml.sax.EntityResolver


    public class XMLEntityResolver
    extends java.lang.Object
    implements org.xml.sax.EntityResolver
    This class implements the EntityResolver interface that helps the xml parser resolve where DTD, XSD files are located.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      XMLEntityResolver()
      Constructor for XMLEntityResolver.
      XMLEntityResolver(java.lang.String dtdPath)
      Constructor for XMLEntityResolver.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.io.File findFile(java.lang.String filename, java.lang.String path)
      Searches the path for the file.
      java.lang.String getSystemId()
      Gets the system identifier.
      java.lang.String resolveDtdName(java.lang.String systemId)
      Resolves the DTD/XSD name
      org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
      This is the method defined in EntityResolver.
      void setRedirect(java.lang.String dtdPath)
      Sets the DTD/XSD path.
      void setSystemId(java.lang.String newSystemId)
      Sets the system identifier.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • XMLEntityResolver

        public XMLEntityResolver()
        Constructor for XMLEntityResolver.
      • XMLEntityResolver

        public XMLEntityResolver(java.lang.String dtdPath)
        Constructor for XMLEntityResolver.
        Parameters:
        dtdPath - the path of the DTD/XSD
    • Method Detail

      • findFile

        public static final java.io.File findFile(java.lang.String filename,
                                                  java.lang.String path)
        Searches the path for the file.
        Parameters:
        filename - the file name
        the - file path
      • getSystemId

        public java.lang.String getSystemId()
        Gets the system identifier.
        Returns:
        the system identifier
      • resolveDtdName

        public java.lang.String resolveDtdName(java.lang.String systemId)
        Resolves the DTD/XSD name
        Parameters:
        systemId - the system identifier of the external entity being referenced for DTD, or the location of the xml schema
      • resolveEntity

        public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                                     java.lang.String systemId)
                                              throws org.xml.sax.SAXException
        This is the method defined in EntityResolver. Note that for our purpose, we won't be using PUBLIC DTDs so we always look for the SYSTEM DTD only.
        Specified by:
        resolveEntity in interface org.xml.sax.EntityResolver
        Parameters:
        publicId - the public identifier of the external entity being referenced, or null if none was supplied.
        systemId - the system identifier of the external entity being referenced
        Returns:
        An InputSource object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.
        Throws:
        org.xml.sax.SAXException - if the dtd or xml schema file cannot be resolved.
      • setRedirect

        public void setRedirect(java.lang.String dtdPath)
        Sets the DTD/XSD path.
        Parameters:
        dtdPath - the path of the DTD/XSD
      • setSystemId

        public void setSystemId(java.lang.String newSystemId)
        Sets the system identifier.
        Parameters:
        newSystemId - the system identifier of the external entity being referenced