Class X3DEntityResolver
- All Implemented Interfaces:
EntityResolver
The entity resolver only handles queries for the DTD. It will find
any URI that ends in *.dtd and return an InputSource
.
As the X3D specification does not yet define what the system resource ID is, we'll take a guess. The current resolution scheme only strips the name of the DTD from the URI and attempts to find that in the classpath.
To determine the DTD name it will search from the end of the string until it finds a '/' character. The resulting string is treated as a filename to search for and has the directory DTD/ prepended to the name. This filename is then found in the CLASSPATH used by the application using the standard Java resolution rules. Note that we do not need to implement any more intelligent behaviour than this because if the System or PublicID returned are files or URLs, the standard parser mechanisms will load them. The only more intelligent behaviour that we may wish to add in the future will be to resolve a full URN if we are given it.
The current implementation ignores the publicId information.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResolve the DTD uri and return an InputStream used by this.Resolve the DTD uri and return an InputStream used by this.resolveEntity
(String publicId, String systemId) Resolve the combination of system and public identifiers.
-
Constructor Details
-
X3DEntityResolver
public X3DEntityResolver()
-
-
Method Details
-
resolveEntity
Resolve the combination of system and public identifiers. This resolver ignores the publicId information.- Specified by:
resolveEntity
in interfaceEntityResolver
- Parameters:
publicId
- The public identifier to use (if set)systemId
- The system identifier to resolve- Returns:
- An input source to the entity or null if not handled
- Throws:
IOException
- An error reading the stream
-
resolveDTDFromSystem
Resolve the DTD uri and return an InputStream used by this.- Parameters:
uri
- The DTD uri to resolve- Returns:
- An input stream to the entity or null if not handled
- Throws:
IOException
- An error reading the stream
-
resolveDTDFromPublic
Resolve the DTD uri and return an InputStream used by this.- Parameters:
id
- The DTD uri to resolve- Returns:
- An input stream to the entity or null if not handled
- Throws:
IOException
- An error reading the stream
-