com.jrefinery.report.io
Class ParserEntityResolver

java.lang.Object
  |
  +--com.jrefinery.report.io.ParserEntityResolver
All Implemented Interfaces:
org.xml.sax.EntityResolver

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

Resolves the JFreeReport DTD specification and routes the parser to a local copy.

Author:
Thomas Morgner

Field Summary
static java.lang.String PUBLIC_ID_EXTENDED
          the Public ID for the extensible version of JFreeReport XML definitions.
static java.lang.String PUBLIC_ID_SIMPLE
          the Public ID for the simple version of JFreeReport XML definitions.
 
Constructor Summary
ParserEntityResolver()
          Creates a new, uninitialized ParserEntityResolver.
 
Method Summary
static ParserEntityResolver getDefaultResolver()
          Returns a default resolver, which is initialized to redirect the parser to a local copy of the JFreeReport DTDs.
 java.net.URL getDTDLocation(java.lang.String publicID)
          Sets the location of the DTD.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Allow the application to resolve external entities.
 boolean setDTDLocation(java.lang.String publicID, java.net.URL location)
          Defines a DTD used to validate the report definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLIC_ID_SIMPLE

public static final java.lang.String PUBLIC_ID_SIMPLE
the Public ID for the simple version of JFreeReport XML definitions.

See Also:
Constant Field Values

PUBLIC_ID_EXTENDED

public static final java.lang.String PUBLIC_ID_EXTENDED
the Public ID for the extensible version of JFreeReport XML definitions.

See Also:
Constant Field Values
Constructor Detail

ParserEntityResolver

public ParserEntityResolver()
Creates a new, uninitialized ParserEntityResolver.

Method Detail

setDTDLocation

public boolean setDTDLocation(java.lang.String publicID,
                              java.net.URL location)
Defines a DTD used to validate the report definition. Your XMLParser must be a validating parser for this feature to work.

Parameters:
publicID - the public ID.
location - the URL.
Returns:
A boolean.

getDTDLocation

public java.net.URL getDTDLocation(java.lang.String publicID)
Sets the location of the DTD. This is used for validating XML parsers to validate the structure of the report definition.

Parameters:
publicID - the id.
Returns:
the URL for the DTD.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Allow the application to resolve external entities.

Resolves the DTD definition to point to a local copy, if the specified public ID is known to this resolver.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Parameters:
publicId - the public ID.
systemId - the system ID.
Returns:
The input source.
Throws:
org.xml.sax.SAXException - if there is a parsing problem.
java.io.IOException - if there is an I/O problem.

getDefaultResolver

public static ParserEntityResolver getDefaultResolver()
Returns a default resolver, which is initialized to redirect the parser to a local copy of the JFreeReport DTDs.

Returns:
the default entity resolver.