Class DefaultXMLEntityResolver

  • All Implemented Interfaces:
    EntityResolver

    public class DefaultXMLEntityResolver
    extends Object
    implements EntityResolver
    A class that permits to load an external XML resource.

    It is based on the systemId and tries to find the file described in the systemId. To do this it tries the following cases in turn and replies the corresponding resource:

    1. if systemId is a local file ie, an file:// URL with or without the URL scheme, if the filename is absolute, and if the file exists then the file's content is replied.
      Example: file:///tmp/mydtd-1.0.dtd
    2. if systemId is a local file ie, an file:// URL with or without the URL scheme, if the filename is relative, and if a file located relatively to the current directory of the XML file exists then the file's content is replied.
      Example: mydirectory/mydtd-1.0.dtd
    3. if systemId is a local file ie, an file:// URL with or without the URL scheme, and if the filename is absolute then the Class.getResource(String) is invoked with the systemId as parameter.
      Example: /fr/utbm/set/package/mydtd-1.0.dtd
    4. if a searchPath was specified to the constructor and if a file located relatively to this searchPath exists, then the file's content is replied.
    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:40
    Author:
    Stéphane GALLAND
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    inputoutput
    • Constructor Detail

      • DefaultXMLEntityResolver

        public DefaultXMLEntityResolver()
        Constructor.
      • DefaultXMLEntityResolver

        public DefaultXMLEntityResolver​(File searchPath)
                                 throws MalformedURLException
        Constructor.
        Parameters:
        searchPath - is the directory which corresponds to a search path.
        Throws:
        MalformedURLException - if the file cannot be converted to an URL.
      • DefaultXMLEntityResolver

        public DefaultXMLEntityResolver​(URL searchPath)
        Constructor.
        Parameters:
        searchPath - is the directory which corresponds to a search path.
      • DefaultXMLEntityResolver

        public DefaultXMLEntityResolver​(boolean assumeEmptyExternalResource)
        Constructor.
        Parameters:
        assumeEmptyExternalResource - if true this entity resolver replies an empty input source when it can't find an external resource. If false this resolver will ask to the default XML resolver to find the external resource.
      • DefaultXMLEntityResolver

        public DefaultXMLEntityResolver​(File searchPath,
                                        boolean assumeEmptyExternalResource)
                                 throws MalformedURLException
        Constructor.
        Parameters:
        searchPath - is the directory which corresponds to a search path.
        assumeEmptyExternalResource - if true this entity resolver replies an empty input source when it can't find an external resource. If false this resolver will ask to the default XML resolver to find the external resource.
        Throws:
        MalformedURLException - if the file cannot be converted to an URL.
      • DefaultXMLEntityResolver

        public DefaultXMLEntityResolver​(URL searchPath,
                                        boolean assumeEmptyExternalResource)
        Constructor.
        Parameters:
        searchPath - is the directory which corresponds to a search path.
        assumeEmptyExternalResource - if true this entity resolver replies an empty input source when it can't find an external resource. If false this resolver will ask to the default XML resolver to find the external resource.