Package org.arakhne.afc.inputoutput.xml
Class DefaultXMLEntityResolver
- java.lang.Object
-
- org.arakhne.afc.inputoutput.xml.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:
- if
systemId
is a local file ie, anfile://
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
- if
systemId
is a local file ie, anfile://
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
- if
systemId
is a local file ie, anfile://
URL with or without the URL scheme, and if the filename is absolute then theClass.getResource(String)
is invoked with thesystemId
as parameter.
Example:/fr/utbm/set/package/mydtd-1.0.dtd
- if a
searchPath
was specified to the constructor and if a file located relatively to thissearchPath
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 Summary
Constructors Constructor Description DefaultXMLEntityResolver()
Constructor.DefaultXMLEntityResolver(boolean assumeEmptyExternalResource)
Constructor.DefaultXMLEntityResolver(File searchPath)
Constructor.DefaultXMLEntityResolver(File searchPath, boolean assumeEmptyExternalResource)
Constructor.DefaultXMLEntityResolver(URL searchPath)
Constructor.DefaultXMLEntityResolver(URL searchPath, boolean assumeEmptyExternalResource)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputSource
resolveEntity(String publicId, String systemId)
-
-
-
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
- iftrue
this entity resolver replies an empty input source when it can't find an external resource. Iffalse
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
- iftrue
this entity resolver replies an empty input source when it can't find an external resource. Iffalse
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
- iftrue
this entity resolver replies an empty input source when it can't find an external resource. Iffalse
this resolver will ask to the default XML resolver to find the external resource.
-
-
Method Detail
-
resolveEntity
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
- Specified by:
resolveEntity
in interfaceEntityResolver
- Throws:
SAXException
IOException
-
-