Class FSEntityResolver

  • All Implemented Interfaces:
    org.xml.sax.EntityResolver

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

    A SAX EntityResolver for common entity references and DTDs in X/HTML processing. Maps official entity references to local copies to avoid network lookup. The local copies are stored in the source tree under /entities, and the references here are resolved by a system ClassLoader. As long as the entity files are in the classpath (or bundled in the FS jar), they will be picked up.

    The basic form of this class comes from Elliot Rusty Harold, on http://www.cafeconleche.org/books/xmljava/chapters/ch07s02.html

    This class is a Singleton; use instance to retrieve it.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.lang.String> entities  
      private static FSEntityResolver instance
      Singleton instance, use instance() to retrieve.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private FSEntityResolver()
      Constructor for the FSEntityResolver object, fill the map of public ids to local urls.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.String> getEntities()
      Returns an unmodifiable map of entities parsed by this resolver.
      static FSEntityResolver instance()
      Gets an instance of this class.
      org.xml.sax.InputSource resolveEntity​(java.lang.String publicID, java.lang.String systemID)  
      • Methods inherited from class java.lang.Object

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

      • entities

        private final java.util.Map<java.lang.String,​java.lang.String> entities
    • Constructor Detail

      • FSEntityResolver

        private FSEntityResolver()
        Constructor for the FSEntityResolver object, fill the map of public ids to local urls.
    • Method Detail

      • resolveEntity

        public org.xml.sax.InputSource resolveEntity​(java.lang.String publicID,
                                                     java.lang.String systemID)
        Specified by:
        resolveEntity in interface org.xml.sax.EntityResolver
      • instance

        public static FSEntityResolver instance()
        Gets an instance of this class.
        Returns:
        An instance of FSEntityResolver.
      • getEntities

        public java.util.Map<java.lang.String,​java.lang.String> getEntities()
        Returns an unmodifiable map of entities parsed by this resolver.
        Returns:
        an unmodifiable map of entities parsed by this resolver.