public class

NonValidatingConfiguration

extends BasicParserConfiguration
implements XMLPullParserConfiguration
java.lang.Object
   ↳ org.apache.xerces.util.ParserConfigurationSettings
     ↳ org.apache.xerces.parsers.BasicParserConfiguration
       ↳ org.apache.xerces.parsers.NonValidatingConfiguration

Class Overview

This is the non validating parser configuration. It extends the basic configuration with the set of following parser components: Document scanner, DTD scanner, namespace binder, document handler.

Xerces parser that uses this configuration is not conformant non-validating XML processor, since conformant non-validating processor is required to process "all the declarations they read in the internal DTD subset ... must use the information in those declarations to normalize attribute values, include the replacement text of internal entities, and supply default attribute values".

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_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 LOAD_EXTERNAL_DTD Feature identifier: load external DTD.
String NAMESPACE_BINDER Property identifier: namespace binder.
String NORMALIZE_DATA Feature identifier: expose schema normalized value
String NOTIFY_BUILTIN_REFS Feature identifier: notify built-in refereces.
String NOTIFY_CHAR_REFS Feature identifier: notify character refereces.
String SCHEMA_ELEMENT_DEFAULT Feature identifier: send element default value via characters()
String SCHEMA_VALIDATOR Property identifier: XML Schema validator.
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 boolean fConfigUpdated fConfigUpdated is set to true if there has been any change to the configuration settings, i.e a feature or a property was changed.
protected XMLDTDScanner fDTDScanner DTD scanner.
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 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
NonValidatingConfiguration()
Default constructor.
NonValidatingConfiguration(SymbolTable symbolTable)
Constructs a parser configuration using the specified symbol table.
NonValidatingConfiguration(SymbolTable symbolTable, XMLGrammarPool grammarPool)
Constructs a parser configuration using the specified symbol table and grammar pool.
NonValidatingConfiguration(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 getFeature(String featureId)
Returns the state of a feature.
boolean parse(boolean complete)
Parses the document in a pull parsing fashion.
void parse(XMLInputSource source)
Parses the specified input source.
void setFeature(String featureId, boolean state)
Set the state of a feature.
void setInputSource(XMLInputSource inputSource)
Sets the input source for the document to parse.
void setLocale(Locale locale)
Set the locale to use for messages.
void setProperty(String propertyId, Object value)
setProperty
Protected Methods
void checkFeature(String featureId)
Check a feature.
void checkProperty(String propertyId)
Check a property.
void configurePipeline()
Configures the pipeline.
XMLDTDScanner createDTDScanner()
Create a DTD scanner.
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.
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_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 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 NORMALIZE_DATA

Feature identifier: expose schema normalized value

Constant Value: "http://apache.org/xml/features/validation/schema/normalized-value"

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 String SCHEMA_ELEMENT_DEFAULT

Feature identifier: send element default value via characters()

Constant Value: "http://apache.org/xml/features/validation/schema/element-default"

protected static final String SCHEMA_VALIDATOR

Property identifier: XML Schema validator.

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

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 boolean fConfigUpdated

fConfigUpdated is set to true if there has been any change to the configuration settings, i.e a feature or a property was changed.

protected XMLDTDScanner fDTDScanner

DTD scanner.

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 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 NonValidatingConfiguration ()

Default constructor.

public NonValidatingConfiguration (SymbolTable symbolTable)

Constructs a parser configuration using the specified symbol table.

Parameters
symbolTable The symbol table to use.

public NonValidatingConfiguration (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 NonValidatingConfiguration (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 getFeature (String featureId)

Returns the state of a feature.

Parameters
featureId The feature identifier.
Returns
  • true if the feature is supported

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 setFeature (String featureId, boolean state)

Set the state of a feature. Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.

Parameters
featureId The unique identifier (URI) of the feature.
state The requested state of the feature (true or false).

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.

public void setProperty (String propertyId, Object value)

setProperty

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 configurePipeline ()

Configures the pipeline.

protected XMLDTDScanner createDTDScanner ()

Create a DTD scanner.

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 ValidationManager createValidationManager ()

protected void reset ()

Reset all components before parsing.

Throws
XNIException Thrown if an error occurs during initialization.