Class EntityReferences

  • All Implemented Interfaces:
    EntityResolver

    public class EntityReferences
    extends Object
    implements EntityResolver
    Resolves system Ids for schema files to the schema file content.
    • Constructor Detail

      • EntityReferences

        public EntityReferences()
    • Method Detail

      • addEntityReference

        public void addEntityReference​(String systemId,
                                       byte[] content)
        Adds a new entity reference.
        Parameters:
        systemId - the systemId of the entity, not null.
        content - the content of the entity, not null.
        Throws:
        NullPointerException - if systemId or content are null.
        IllegalArgumentException - if the systemId is already defined.
      • containsSystemId

        public boolean containsSystemId​(String systemId)
        Returns whether the given system id is known.
        Parameters:
        systemId - the system id to check.
        Returns:
        true if the system id can be resolved, false otherwise.
      • getEntityReferences

        public Map<String,​byte[]> getEntityReferences()
        Returns a copy of the entity reference map.
        Returns:
        a copy of the entity reference map.
      • resolveEntity

        public InputSource resolveEntity​(String publicId,
                                         String systemId)
                                  throws IOException,
                                         SAXException
        An implementation of the SAX EntityResolver interface to be called by the XML parser. If the systemId is known, the corresponding resource from the jar is returned. In all other cases, null is returned to indicate that the parser should open a regular connection to the systemId URI.
        Specified by:
        resolveEntity in interface EntityResolver
        Parameters:
        publicId - The public identifier of the external entity
        systemId - The system identifier of the external entity
        Returns:
        An InputSource for the entity if the systemId is known, or null otherwise.
        Throws:
        IOException
        SAXException