j3d.org Code

org.j3d.util
Class SAXEntityResolver

java.lang.Object
  extended by org.j3d.util.SAXEntityResolver
All Implemented Interfaces:
org.xml.sax.EntityResolver

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

An entity resolver for both DOM and SAX models of the SAX document.

The entity resolver only handles queries for the DTD. It will find any URI that ends in *.dtd and return an InputSource.

As the SAX 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. 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.

Version:
$Revision: 1.4 $
Author:
Justin Couch

Constructor Summary
SAXEntityResolver()
           
 
Method Summary
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Resolve the combination of system and public identifiers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SAXEntityResolver

public SAXEntityResolver()
Method Detail

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws java.io.IOException
Resolve the combination of system and public identifiers. This resolver ignores the publicId information.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
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:
java.io.IOException - An error reading the stream

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org