public class

DTDConfiguration

extends BasicParserConfiguration
implements XMLPullParserConfiguration
java.lang.Object
   ↳ org.apache.xerces.util.ParserConfigurationSettings
     ↳ org.apache.xerces.parsers.BasicParserConfiguration
       ↳ org.apache.xerces.parsers.DTDConfiguration
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

This is the DTD-only parser configuration. It extends the basic configuration with a standard set of parser components appropriate to DTD-centric validation. Since the Xerces2 reference implementation document and DTD scanner implementations are capable of acting as pull parsers, this configuration implements the XMLPullParserConfiguration interface.

In addition to the features and properties recognized by the base parser configuration, this class recognizes these additional features and properties:

  • Features
    • http://apache.org/xml/features/validation/warn-on-duplicate-attdef
    • http://apache.org/xml/features/validation/warn-on-undeclared-elemdef
    • http://apache.org/xml/features/allow-java-encodings
    • http://apache.org/xml/features/continue-after-fatal-error
    • http://apache.org/xml/features/load-external-dtd
  • Properties
    • http://apache.org/xml/properties/internal/error-reporter
    • http://apache.org/xml/properties/internal/entity-manager
    • http://apache.org/xml/properties/internal/document-scanner
    • http://apache.org/xml/properties/internal/dtd-scanner
    • http://apache.org/xml/properties/internal/grammar-pool
    • http://apache.org/xml/properties/internal/validator/dtd
    • http://apache.org/xml/properties/internal/datatype-validator-factory

Summary

Constants
String ALLOW_JAVA_ENCODINGS Feature identifier: allow Java encodings.
String CONTINUE_AFTER_FATAL_ERROR Feature identifier: continue after fatal error.
String DATATYPE_VALIDATOR_FACTORY Property identifier: datatype validator factory.
String DOCUMENT_SCANNER Property identifier document scanner:
String DTD_PROCESSOR Property identifier: DTD loader.
String DTD_SCANNER Property identifier: DTD scanner.
String DTD_VALIDATOR Property identifier: DTD validator.
String ENTITY_MANAGER Property identifier: entity manager.
String ERROR_REPORTER Property identifier: error reporter.
String JAXP_SCHEMA_LANGUAGE Property identifier: JAXP schema language / DOM schema-type.
String JAXP_SCHEMA_SOURCE Property identifier: JAXP schema source/ DOM schema-location.
String LOAD_EXTERNAL_DTD Feature identifier: load external DTD.
String NAMESPACE_BINDER Property identifier: namespace binder.
String NOTIFY_BUILTIN_REFS Feature identifier: notify built-in refereces.
String NOTIFY_CHAR_REFS Feature identifier: notify character refereces.
boolean PRINT_EXCEPTION_STACK_TRACE Set to true and recompile to print exception stack trace.
String VALIDATION_MANAGER
String WARN_ON_DUPLICATE_ATTDEF Feature identifier: warn on duplicate attribute definition.
String WARN_ON_DUPLICATE_ENTITYDEF Feature identifier: warn on duplicate entity definition.
String WARN_ON_UNDECLARED_ELEMDEF Feature identifier: warn on undeclared element definition.
String XMLGRAMMAR_POOL Property identifier: grammar pool.
[Expand]
Inherited Constants
From class org.apache.xerces.parsers.BasicParserConfiguration
From class org.apache.xerces.util.ParserConfigurationSettings
Fields
protected XMLDTDProcessor fDTDProcessor DTD Processor .
protected XMLDTDScanner fDTDScanner DTD scanner.
protected XMLDTDValidator fDTDValidator DTD Validator.
protected DTDDVFactory fDatatypeValidatorFactory Datatype validator factory.
protected XMLEntityManager fEntityManager Entity manager.
protected XMLErrorReporter fErrorReporter Error reporter.
protected XMLGrammarPool fGrammarPool Grammar pool.
protected XMLInputSource fInputSource Input Source
protected XMLLocator fLocator Locator
protected XMLNamespaceBinder fNamespaceBinder Namespace binder.
protected boolean fParseInProgress True if a parse is in progress.
protected XMLDocumentScanner fScanner Document scanner.
protected ValidationManager fValidationManager
[Expand]
Inherited Fields
From class org.apache.xerces.parsers.BasicParserConfiguration
From class org.apache.xerces.util.ParserConfigurationSettings
Public Constructors
DTDConfiguration()
Default constructor.
DTDConfiguration(SymbolTable symbolTable)
Constructs a parser configuration using the specified symbol table.
DTDConfiguration(SymbolTable symbolTable, XMLGrammarPool grammarPool)
Constructs a parser configuration using the specified symbol table and grammar pool.
DTDConfiguration(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLComponentManager parentSettings)
Constructs a parser configuration using the specified symbol table, grammar pool, and parent settings.
Public Methods
void cleanup()
If the application decides to terminate parsing before the xml document is fully parsed, the application should call this method to free any resource allocated during parsing.
boolean parse(boolean complete)
Parses the document in a pull parsing fashion.
void parse(XMLInputSource source)
Parses the specified input source.
void setInputSource(XMLInputSource inputSource)
Sets the input source for the document to parse.
void setLocale(Locale locale)
Set the locale to use for messages.
Protected Methods
void checkFeature(String featureId)
Check a feature.
void checkProperty(String propertyId)
Check a property.
void configureDTDPipeline()
void configurePipeline()
Configures the pipeline.
XMLDTDProcessor createDTDProcessor()
Create a DTD loader .
XMLDTDScanner createDTDScanner()
Create a DTD scanner.
XMLDTDValidator createDTDValidator()
Create a DTD validator.
DTDDVFactory createDatatypeValidatorFactory()
Create a datatype validator factory.
XMLDocumentScanner createDocumentScanner()
Create a document scanner.
XMLEntityManager createEntityManager()
Creates an entity manager.
XMLErrorReporter createErrorReporter()
Creates an error reporter.
XMLNamespaceBinder createNamespaceBinder()
Create a namespace binder.
ValidationManager createValidationManager()
void reset()
Reset all components before parsing.
[Expand]
Inherited Methods
From class org.apache.xerces.parsers.BasicParserConfiguration
From class org.apache.xerces.util.ParserConfigurationSettings
From class java.lang.Object
From interface org.apache.xerces.xni.parser.XMLComponentManager
From interface org.apache.xerces.xni.parser.XMLParserConfiguration
From interface org.apache.xerces.xni.parser.XMLPullParserConfiguration

Constants

protected static final String ALLOW_JAVA_ENCODINGS

Feature identifier: allow Java encodings.

Constant Value: "http://apache.org/xml/features/allow-java-encodings"

protected static final String CONTINUE_AFTER_FATAL_ERROR

Feature identifier: continue after fatal error.

Constant Value: "http://apache.org/xml/features/continue-after-fatal-error"

protected static final String DATATYPE_VALIDATOR_FACTORY

Property identifier: datatype validator factory.

Constant Value: "http://apache.org/xml/properties/internal/datatype-validator-factory"

protected static final String DOCUMENT_SCANNER

Property identifier document scanner:

Constant Value: "http://apache.org/xml/properties/internal/document-scanner"

protected static final String DTD_PROCESSOR

Property identifier: DTD loader.

Constant Value: "http://apache.org/xml/properties/internal/dtd-processor"

protected static final String DTD_SCANNER

Property identifier: DTD scanner.

Constant Value: "http://apache.org/xml/properties/internal/dtd-scanner"

protected static final String DTD_VALIDATOR

Property identifier: DTD validator.

Constant Value: "http://apache.org/xml/properties/internal/validator/dtd"

protected static final String ENTITY_MANAGER

Property identifier: entity manager.

Constant Value: "http://apache.org/xml/properties/internal/entity-manager"

protected static final String ERROR_REPORTER

Property identifier: error reporter.

Constant Value: "http://apache.org/xml/properties/internal/error-reporter"

protected static final String JAXP_SCHEMA_LANGUAGE

Property identifier: JAXP schema language / DOM schema-type.

Constant Value: "http://java.sun.com/xml/jaxp/properties/schemaLanguage"

protected static final String JAXP_SCHEMA_SOURCE

Property identifier: JAXP schema source/ DOM schema-location.

Constant Value: "http://java.sun.com/xml/jaxp/properties/schemaSource"

protected static final String LOAD_EXTERNAL_DTD

Feature identifier: load external DTD.

Constant Value: "http://apache.org/xml/features/nonvalidating/load-external-dtd"

protected static final String NAMESPACE_BINDER

Property identifier: namespace binder.

Constant Value: "http://apache.org/xml/properties/internal/namespace-binder"

protected static final String NOTIFY_BUILTIN_REFS

Feature identifier: notify built-in refereces.

Constant Value: "http://apache.org/xml/features/scanner/notify-builtin-refs"

protected static final String NOTIFY_CHAR_REFS

Feature identifier: notify character refereces.

Constant Value: "http://apache.org/xml/features/scanner/notify-char-refs"

protected static final boolean PRINT_EXCEPTION_STACK_TRACE

Set to true and recompile to print exception stack trace.

Constant Value: false

protected static final String VALIDATION_MANAGER

Constant Value: "http://apache.org/xml/properties/internal/validation-manager"

protected static final String WARN_ON_DUPLICATE_ATTDEF

Feature identifier: warn on duplicate attribute definition.

Constant Value: "http://apache.org/xml/features/validation/warn-on-duplicate-attdef"

protected static final String WARN_ON_DUPLICATE_ENTITYDEF

Feature identifier: warn on duplicate entity definition.

Constant Value: "http://apache.org/xml/features/warn-on-duplicate-entitydef"

protected static final String WARN_ON_UNDECLARED_ELEMDEF

Feature identifier: warn on undeclared element definition.

Constant Value: "http://apache.org/xml/features/validation/warn-on-undeclared-elemdef"

protected static final String XMLGRAMMAR_POOL

Property identifier: grammar pool.

Constant Value: "http://apache.org/xml/properties/internal/grammar-pool"

Fields

protected XMLDTDProcessor fDTDProcessor

DTD Processor .

protected XMLDTDScanner fDTDScanner

DTD scanner.

protected XMLDTDValidator fDTDValidator

DTD Validator.

protected DTDDVFactory fDatatypeValidatorFactory

Datatype validator factory.

protected XMLEntityManager fEntityManager

Entity manager.

protected XMLErrorReporter fErrorReporter

Error reporter.

protected XMLGrammarPool fGrammarPool

Grammar pool.

protected XMLInputSource fInputSource

Input Source

protected XMLLocator fLocator

Locator

protected XMLNamespaceBinder fNamespaceBinder

Namespace binder.

protected boolean fParseInProgress

True if a parse is in progress. This state is needed because some features/properties cannot be set while parsing (e.g. validation and namespaces).

protected XMLDocumentScanner fScanner

Document scanner.

protected ValidationManager fValidationManager

Public Constructors

public DTDConfiguration ()

Default constructor.

public DTDConfiguration (SymbolTable symbolTable)

Constructs a parser configuration using the specified symbol table.

Parameters
symbolTable The symbol table to use.

public DTDConfiguration (SymbolTable symbolTable, XMLGrammarPool grammarPool)

Constructs a parser configuration using the specified symbol table and grammar pool.

REVISIT: Grammar pool will be updated when the new validation engine is implemented.

Parameters
symbolTable The symbol table to use.
grammarPool The grammar pool to use.

public DTDConfiguration (SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLComponentManager parentSettings)

Constructs a parser configuration using the specified symbol table, grammar pool, and parent settings.

REVISIT: Grammar pool will be updated when the new validation engine is implemented.

Parameters
symbolTable The symbol table to use.
grammarPool The grammar pool to use.
parentSettings The parent settings.

Public Methods

public void cleanup ()

If the application decides to terminate parsing before the xml document is fully parsed, the application should call this method to free any resource allocated during parsing. For example, close all opened streams.

public boolean parse (boolean complete)

Parses the document in a pull parsing fashion.

Parameters
complete True if the pull parser should parse the remaining document completely.
Returns
  • True if there is more document to parse.
Throws
XNIException Any XNI exception, possibly wrapping another exception.
IOException An IO exception from the parser, possibly from a byte stream or character stream supplied by the parser.

public void parse (XMLInputSource source)

Parses the specified input source.

Parameters
source The input source.
Throws
XNIException Throws exception on XNI error.
IOException Throws exception on i/o error.

public void setInputSource (XMLInputSource inputSource)

Sets the input source for the document to parse.

Parameters
inputSource The document's input source.
Throws
XMLConfigurationException Thrown if there is a configuration error when initializing the parser.
IOException Thrown on I/O error.
See Also

public void setLocale (Locale locale)

Set the locale to use for messages.

Parameters
locale The locale object to use for localization of messages.
Throws
XNIException Thrown if the parser does not support the specified locale.

Protected Methods

protected void checkFeature (String featureId)

Check a feature. If feature is know and supported, this method simply returns. Otherwise, the appropriate exception is thrown.

Parameters
featureId The unique identifier (URI) of the feature.
Throws
XMLConfigurationException Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

protected void checkProperty (String propertyId)

Check a property. If the property is know and supported, this method simply returns. Otherwise, the appropriate exception is thrown.

Parameters
propertyId The unique identifier (URI) of the property being set.
Throws
XMLConfigurationException Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

protected void configureDTDPipeline ()

protected void configurePipeline ()

Configures the pipeline.

protected XMLDTDProcessor createDTDProcessor ()

Create a DTD loader .

protected XMLDTDScanner createDTDScanner ()

Create a DTD scanner.

protected XMLDTDValidator createDTDValidator ()

Create a DTD validator.

protected DTDDVFactory createDatatypeValidatorFactory ()

Create a datatype validator factory.

protected XMLDocumentScanner createDocumentScanner ()

Create a document scanner.

protected XMLEntityManager createEntityManager ()

Creates an entity manager.

protected XMLErrorReporter createErrorReporter ()

Creates an error reporter.

protected XMLNamespaceBinder createNamespaceBinder ()

Create a namespace binder.

protected ValidationManager createValidationManager ()

protected void reset ()

Reset all components before parsing.

Throws
XNIException Thrown if an error occurs during initialization.