FileDocCategorySizeDatePackage
SchemaParsingConfig.javaAPI DocApache Xerces 3.0.138541Fri Sep 14 20:33:52 BST 2007org.apache.xerces.impl.xs.opti

SchemaParsingConfig

public class SchemaParsingConfig extends org.apache.xerces.parsers.BasicParserConfiguration implements org.apache.xerces.xni.parser.XMLPullParserConfiguration
xerces.internal
author
Rahul Srivastava, Sun Microsystems Inc.
version
$Id: SchemaParsingConfig.java 467849 2006-10-26 03:16:00Z mrglavas $

Fields Summary
protected static final String
XML11_DATATYPE_VALIDATOR_FACTORY
protected static final String
WARN_ON_DUPLICATE_ATTDEF
Feature identifier: warn on duplicate attribute definition.
protected static final String
WARN_ON_UNDECLARED_ELEMDEF
Feature identifier: warn on undeclared element definition.
protected static final String
ALLOW_JAVA_ENCODINGS
Feature identifier: allow Java encodings.
protected static final String
CONTINUE_AFTER_FATAL_ERROR
Feature identifier: continue after fatal error.
protected static final String
LOAD_EXTERNAL_DTD
Feature identifier: load external DTD.
protected static final String
NOTIFY_BUILTIN_REFS
Feature identifier: notify built-in refereces.
protected static final String
NOTIFY_CHAR_REFS
Feature identifier: notify character refereces.
protected static final String
NORMALIZE_DATA
Feature identifier: expose schema normalized value
protected static final String
SCHEMA_ELEMENT_DEFAULT
Feature identifier: send element default value via characters()
protected static final String
GENERATE_SYNTHETIC_ANNOTATIONS
Feature identifier: generate synthetic annotations.
protected static final String
ERROR_REPORTER
Property identifier: error reporter.
protected static final String
ENTITY_MANAGER
Property identifier: entity manager.
protected static final String
DOCUMENT_SCANNER
Property identifier document scanner:
protected static final String
DTD_SCANNER
Property identifier: DTD scanner.
protected static final String
XMLGRAMMAR_POOL
Property identifier: grammar pool.
protected static final String
DTD_VALIDATOR
Property identifier: DTD validator.
protected static final String
NAMESPACE_BINDER
Property identifier: namespace binder.
protected static final String
DATATYPE_VALIDATOR_FACTORY
Property identifier: datatype validator factory.
protected static final String
VALIDATION_MANAGER
protected static final String
SCHEMA_VALIDATOR
Property identifier: XML Schema validator.
private static final boolean
PRINT_EXCEPTION_STACK_TRACE
Set to true and recompile to print exception stack trace.
protected final org.apache.xerces.impl.dv.DTDDVFactory
fDatatypeValidatorFactory
The XML 1.0 Datatype validator factory.
protected final org.apache.xerces.impl.XMLNSDocumentScannerImpl
fNamespaceScanner
The XML 1.0 Document scanner.
protected final org.apache.xerces.impl.XMLDTDScannerImpl
fDTDScanner
The XML 1.0 DTD scanner.
protected org.apache.xerces.impl.dv.DTDDVFactory
fXML11DatatypeFactory
The XML 1.1 Datatype validator factory.
protected org.apache.xerces.impl.XML11NSDocumentScannerImpl
fXML11NSDocScanner
The XML 1.1 Document scanner.
protected org.apache.xerces.impl.XML11DTDScannerImpl
fXML11DTDScanner
The XML 1.1 DTD scanner.
protected org.apache.xerces.impl.dv.DTDDVFactory
fCurrentDVFactory
Current Datatype validator factory.
protected org.apache.xerces.xni.parser.XMLDocumentScanner
fCurrentScanner
Current scanner
protected org.apache.xerces.xni.parser.XMLDTDScanner
fCurrentDTDScanner
Current DTD scanner.
protected org.apache.xerces.xni.grammars.XMLGrammarPool
fGrammarPool
Grammar pool.
protected final org.apache.xerces.impl.XMLVersionDetector
fVersionDetector
XML version detector.
protected final org.apache.xerces.impl.XMLErrorReporter
fErrorReporter
Error reporter.
protected final org.apache.xerces.impl.XMLEntityManager
fEntityManager
Entity manager.
protected org.apache.xerces.xni.parser.XMLInputSource
fInputSource
Input Source
protected SchemaDOMParser
fSchemaDOMParser
protected final org.apache.xerces.impl.validation.ValidationManager
fValidationManager
protected org.apache.xerces.xni.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 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.
private boolean
f11Initialized
Flag indiciating whether XML11 components have been initialized.
Constructors Summary
public SchemaParsingConfig()
Default constructor.

    
    //
    // Constructors
    //
    
       
      
        this(null, null, null);
    
public SchemaParsingConfig(org.apache.xerces.util.SymbolTable symbolTable)
Constructs a parser configuration using the specified symbol table.

param
symbolTable The symbol table to use.

        this(symbolTable, null, null);
    
public SchemaParsingConfig(org.apache.xerces.util.SymbolTable symbolTable, org.apache.xerces.xni.grammars.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.

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

        this(symbolTable, grammarPool, null);
    
public SchemaParsingConfig(org.apache.xerces.util.SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool, org.apache.xerces.xni.parser.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.

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

        super(symbolTable, parentSettings);
        
        // add default recognized features
        final String[] recognizedFeatures = {
            PARSER_SETTINGS, WARN_ON_DUPLICATE_ATTDEF,   WARN_ON_UNDECLARED_ELEMDEF,
            ALLOW_JAVA_ENCODINGS,       CONTINUE_AFTER_FATAL_ERROR,
            LOAD_EXTERNAL_DTD,          NOTIFY_BUILTIN_REFS,
            NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS
        };
        addRecognizedFeatures(recognizedFeatures);
        fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
        // set state for default features
        fFeatures.put(WARN_ON_DUPLICATE_ATTDEF, Boolean.FALSE);
        //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false);
        fFeatures.put(WARN_ON_UNDECLARED_ELEMDEF, Boolean.FALSE);
        fFeatures.put(ALLOW_JAVA_ENCODINGS, Boolean.FALSE);
        fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
        fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
        fFeatures.put(NOTIFY_BUILTIN_REFS, Boolean.FALSE);
        fFeatures.put(NOTIFY_CHAR_REFS, Boolean.FALSE);
        fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
        
        // add default recognized properties
        final String[] recognizedProperties = {
            ERROR_REPORTER,             
            ENTITY_MANAGER, 
            DOCUMENT_SCANNER,
            DTD_SCANNER,
            DTD_VALIDATOR,
            NAMESPACE_BINDER,
            XMLGRAMMAR_POOL,   
            DATATYPE_VALIDATOR_FACTORY,
            VALIDATION_MANAGER,
            GENERATE_SYNTHETIC_ANNOTATIONS
        };
        addRecognizedProperties(recognizedProperties);
        
        fGrammarPool = grammarPool;
        if (fGrammarPool != null) {
            setProperty(XMLGRAMMAR_POOL, fGrammarPool);
        }
        
        fEntityManager = new XMLEntityManager();
        fProperties.put(ENTITY_MANAGER, fEntityManager);
        addComponent(fEntityManager);
        
        fErrorReporter = new XMLErrorReporter();
        fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
        fProperties.put(ERROR_REPORTER, fErrorReporter);
        addComponent(fErrorReporter);
        
        fNamespaceScanner = new XMLNSDocumentScannerImpl();
        fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
        addRecognizedParamsAndSetDefaults(fNamespaceScanner);
        
        fDTDScanner = new XMLDTDScannerImpl();
        fProperties.put(DTD_SCANNER, fDTDScanner);
        addRecognizedParamsAndSetDefaults(fDTDScanner);
        
        fDatatypeValidatorFactory = DTDDVFactory.getInstance();
        fProperties.put(DATATYPE_VALIDATOR_FACTORY,
                fDatatypeValidatorFactory);
        
        fValidationManager = new ValidationManager();
        fProperties.put(VALIDATION_MANAGER, fValidationManager);
        
        fVersionDetector = new XMLVersionDetector();
        
        // add message formatters
        if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
            XMLMessageFormatter xmft = new XMLMessageFormatter();
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
        }
        
        if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
            XSMessageFormatter xmft = new XSMessageFormatter();
            fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
        }
        
        // set locale
        try {
            setLocale(Locale.getDefault()); 
        }
        catch (XNIException e) {
            // do nothing
            // REVISIT: What is the right thing to do? -Ac
        }
        
    
Methods Summary
private voidaddRecognizedParamsAndSetDefaults(org.apache.xerces.xni.parser.XMLComponent component)
Adds all of the component's recognized features and properties to the list of default recognized features and properties, and sets default values on the configuration for features and properties which were previously absent from the configuration.

param
component The component whose recognized features and properties will be added to the configuration

        
        // register component's recognized features
        String[] recognizedFeatures = component.getRecognizedFeatures();
        addRecognizedFeatures(recognizedFeatures);
        
        // register component's recognized properties
        String[] recognizedProperties = component.getRecognizedProperties();
        addRecognizedProperties(recognizedProperties);

        // set default values
        if (recognizedFeatures != null) {
            for (int i = 0; i < recognizedFeatures.length; ++i) {
                String featureId = recognizedFeatures[i];
                Boolean state = component.getFeatureDefault(featureId);
                if (state != null) {
                    // Do not overwrite values already set on the configuration.
                    if (!fFeatures.containsKey(featureId)) {
                        fFeatures.put(featureId, state);
                        // For newly added components who recognize this feature
                        // but did not offer a default value, we need to make
                        // sure these components will get an opportunity to read
                        // the value before parsing begins.
                        fConfigUpdated = true;
                    }
                }
            }
        }
        if (recognizedProperties != null) {
            for (int i = 0; i < recognizedProperties.length; ++i) {
                String propertyId = recognizedProperties[i];
                Object value = component.getPropertyDefault(propertyId);
                if (value != null) {
                    // Do not overwrite values already set on the configuration.
                    if (!fProperties.containsKey(propertyId)) {
                        fProperties.put(propertyId, value);
                        // For newly added components who recognize this property
                        // but did not offer a default value, we need to make
                        // sure these components will get an opportunity to read
                        // the value before parsing begins.
                        fConfigUpdated = true;
                    }
                }
            }
        }
    
protected voidcheckFeature(java.lang.String featureId)
Check a feature. If feature is know and supported, this method simply returns. Otherwise, the appropriate exception is thrown.

param
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.

        
        //
        // Xerces Features
        //
        
        if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
            final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
            
            //
            // http://apache.org/xml/features/validation/dynamic
            //   Allows the parser to validate a document only when it
            //   contains a grammar. Validation is turned on/off based
            //   on each document instance, automatically.
            //
            if (suffixLength == Constants.DYNAMIC_VALIDATION_FEATURE.length() && 
                    featureId.endsWith(Constants.DYNAMIC_VALIDATION_FEATURE)) {
                return;
            }
            //
            // http://apache.org/xml/features/validation/default-attribute-values
            //
            if (suffixLength == Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length() && 
                    featureId.endsWith(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) {
                // REVISIT
                short type = XMLConfigurationException.NOT_SUPPORTED;
                throw new XMLConfigurationException(type, featureId);
            }
            //
            // http://apache.org/xml/features/validation/default-attribute-values
            //
            if (suffixLength == Constants.VALIDATE_CONTENT_MODELS_FEATURE.length() && 
                    featureId.endsWith(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
                // REVISIT
                short type = XMLConfigurationException.NOT_SUPPORTED;
                throw new XMLConfigurationException(type, featureId);
            }
            //
            // http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
            //
            if (suffixLength == Constants.LOAD_DTD_GRAMMAR_FEATURE.length() && 
                    featureId.endsWith(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
                return;
            }
            //
            // http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
            //
            if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() && 
                    featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
                return;
            }
            
            //
            // http://apache.org/xml/features/validation/default-attribute-values
            //
            if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
                    featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
                short type = XMLConfigurationException.NOT_SUPPORTED;
                throw new XMLConfigurationException(type, featureId);
            }
        }
        
        //
        // Not recognized
        //
        
        super.checkFeature(featureId);
        
    
protected voidcheckProperty(java.lang.String propertyId)
Check a property. If the property is know and supported, this method simply returns. Otherwise, the appropriate exception is thrown.

param
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.

        
        //
        // Xerces Properties
        //
        
        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
            final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
            
            if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length() && 
                    propertyId.endsWith(Constants.DTD_SCANNER_PROPERTY)) {
                return;
            }
        }
        
        if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
            final int suffixLength = propertyId.length() - Constants.JAXP_PROPERTY_PREFIX.length();
            
            if (suffixLength == Constants.SCHEMA_SOURCE.length() && 
                    propertyId.endsWith(Constants.SCHEMA_SOURCE)) {
                return;
            }
        }
        
        //
        // Not recognized
        //
        
        super.checkProperty(propertyId);
        
    
public voidcleanup()
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.

        fEntityManager.closeReaders();
    
protected voidconfigurePipeline()
Configures the XML 1.0 pipeline.

        
        if (fCurrentDVFactory != fDatatypeValidatorFactory) {
            fCurrentDVFactory = fDatatypeValidatorFactory;
            // use XML 1.0 datatype library
            setProperty(DATATYPE_VALIDATOR_FACTORY, fCurrentDVFactory);
        }
        
        // setup document pipeline
        if (fCurrentScanner != fNamespaceScanner) {
            fCurrentScanner = fNamespaceScanner;
            setProperty(DOCUMENT_SCANNER, fCurrentScanner);
        }
        fNamespaceScanner.setDocumentHandler(fDocumentHandler);
        if (fDocumentHandler != null) {
            fDocumentHandler.setDocumentSource(fNamespaceScanner);
        }
        fLastComponent = fNamespaceScanner;
        
        // setup dtd pipeline
        if (fCurrentDTDScanner != fDTDScanner) {
            fCurrentDTDScanner = fDTDScanner;
            setProperty(DTD_SCANNER, fCurrentDTDScanner);
        }
        fDTDScanner.setDTDHandler(fDTDHandler);
        if (fDTDHandler != null) {
            fDTDHandler.setDTDSource(fDTDScanner);
        }
        fDTDScanner.setDTDContentModelHandler(fDTDContentModelHandler);
        if (fDTDContentModelHandler != null) {
            fDTDContentModelHandler.setDTDContentModelSource(fDTDScanner);
        } 
        
    
protected voidconfigureXML11Pipeline()
Configures the XML 1.1 pipeline.

        
        if (fCurrentDVFactory != fXML11DatatypeFactory) {
            fCurrentDVFactory = fXML11DatatypeFactory;
            // use XML 1.1 datatype library
            setProperty(DATATYPE_VALIDATOR_FACTORY, fCurrentDVFactory);
        }
        
        // setup document pipeline
        if (fCurrentScanner != fXML11NSDocScanner) {
            fCurrentScanner = fXML11NSDocScanner;
            setProperty(DOCUMENT_SCANNER, fCurrentScanner);
        }
        fXML11NSDocScanner.setDocumentHandler(fDocumentHandler);
        if (fDocumentHandler != null) {
            fDocumentHandler.setDocumentSource(fXML11NSDocScanner);
        }
        fLastComponent = fXML11NSDocScanner;
        
        // setup dtd pipeline
        if (fCurrentDTDScanner != fXML11DTDScanner) {
            fCurrentDTDScanner = fXML11DTDScanner;
            setProperty(DTD_SCANNER, fCurrentDTDScanner);
        }
        fXML11DTDScanner.setDTDHandler(fDTDHandler);
        if (fDTDHandler != null) {
            fDTDHandler.setDTDSource(fXML11DTDScanner);
        }
        fXML11DTDScanner.setDTDContentModelHandler(fDTDContentModelHandler);
        if (fDTDContentModelHandler != null) {
            fDTDContentModelHandler.setDTDContentModelSource(fXML11DTDScanner);
        } 
        
    
public org.w3c.dom.DocumentgetDocument()
Returns the Document object.

        return fSchemaDOMParser.getDocument();
    
public booleangetFeature(java.lang.String featureId)
Returns the state of a feature.

param
featureId The feature identifier.
return
true if the feature is supported
throws
XMLConfigurationException Thrown for configuration error. In general, components should only throw this exception if it is really a critical error.

        // make this feature special
        if (featureId.equals(PARSER_SETTINGS)) {
            return fConfigUpdated;
        }
        return super.getFeature(featureId);

    
private voidinitXML11Components()

        if (!f11Initialized) {
            // create datatype factory
            fXML11DatatypeFactory = DTDDVFactory.getInstance(XML11_DATATYPE_VALIDATOR_FACTORY);

            // setup XML 1.1 DTD pipeline
            fXML11DTDScanner = new XML11DTDScannerImpl();
            addRecognizedParamsAndSetDefaults(fXML11DTDScanner);

            // setup XML 1.1. document pipeline - namespace aware
            fXML11NSDocScanner = new XML11NSDocumentScannerImpl();
            addRecognizedParamsAndSetDefaults(fXML11NSDocScanner);
                
            f11Initialized = true;
        }
    
public booleanparse(boolean complete)
Parses the document in a pull parsing fashion.

param
complete True if the pull parser should parse the remaining document completely.
return
True if there is more document to parse.
exception
XNIException Any XNI exception, possibly wrapping another exception.
exception
IOException An IO exception from the parser, possibly from a byte stream or character stream supplied by the parser.
see
#setInputSource

        //
        // reset and configure pipeline and set InputSource.
        if (fInputSource != null) {
            try {
                fValidationManager.reset();
                fVersionDetector.reset(this);
                reset();

                short version = fVersionDetector.determineDocVersion(fInputSource);
                // XML 1.0
                if (version == Constants.XML_VERSION_1_0) {
                    configurePipeline();
                    resetXML10();
                }
                // XML 1.1
                else if (version == Constants.XML_VERSION_1_1) {
                    initXML11Components();
                    configureXML11Pipeline();
                    resetXML11();
                }
                // Unrecoverable error reported during version detection
                else {
                   return false;
                }
                
                // mark configuration as fixed
                fConfigUpdated = false;

                // resets and sets the pipeline.
                fVersionDetector.startDocumentParsing((XMLEntityHandler) fCurrentScanner, version);
                fInputSource = null;
            } 
            catch (XNIException ex) {
                if (PRINT_EXCEPTION_STACK_TRACE)
                    ex.printStackTrace();
                throw ex;
            } 
            catch (IOException ex) {
                if (PRINT_EXCEPTION_STACK_TRACE)
                    ex.printStackTrace();
                throw ex;
            } 
            catch (RuntimeException ex) {
                if (PRINT_EXCEPTION_STACK_TRACE)
                    ex.printStackTrace();
                throw ex;
            }
            catch (Exception ex) {
                if (PRINT_EXCEPTION_STACK_TRACE)
                    ex.printStackTrace();
                throw new XNIException(ex);
            }
        }
        
        try {
            return fCurrentScanner.scanDocument(complete);
        } 
        catch (XNIException ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw ex;
        } 
        catch (IOException ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw ex;
        } 
        catch (RuntimeException ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw ex;
        }
        catch (Exception ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw new XNIException(ex);
        }
        
    
public voidparse(org.apache.xerces.xni.parser.XMLInputSource source)
Parses the specified input source.

param
source The input source.
exception
XNIException Throws exception on XNI error.
exception
java.io.IOException Throws exception on i/o error.

        
        if (fParseInProgress) {
            // REVISIT - need to add new error message
            throw new XNIException("FWK005 parse may not be called while parsing.");
        }
        fParseInProgress = true;
        
        try {
            setInputSource(source);
            parse(true);
        } 
        catch (XNIException ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw ex;
        } 
        catch (IOException ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw ex;
        }
        catch (RuntimeException ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw ex;
        }              
        catch (Exception ex) {
            if (PRINT_EXCEPTION_STACK_TRACE)
                ex.printStackTrace();
            throw new XNIException(ex);
        }
        finally {
            fParseInProgress = false;
            // close all streams opened by xerces
            this.cleanup();
        }
        
    
public voidreset()
Reset all components before parsing.

throws
XNIException Thrown if an error occurs during initialization.

        
        // set handlers
        if (fSchemaDOMParser == null) {
            fSchemaDOMParser = new SchemaDOMParser(this);
        }
        fDocumentHandler = fSchemaDOMParser;
        fDTDHandler = fSchemaDOMParser;
        fDTDContentModelHandler = fSchemaDOMParser;
        
        // initialize the common components
        super.reset();
        
    
public voidresetNodePool()

        // REVISIT: to implement: introduce a node pool to reuse DTM nodes.
        //          reset this pool here.
    
protected final voidresetXML10()
Reset all XML 1.0 components before parsing

        // Reset XML 1.0 components
        fNamespaceScanner.reset(this);
        fDTDScanner.reset(this);
    
protected final voidresetXML11()
Reset all XML 1.1 components before parsing

        // Reset XML 1.1 components
        fXML11NSDocScanner.reset(this);
        fXML11DTDScanner.reset(this);
    
public voidsetFeature(java.lang.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.

param
featureId The unique identifier (URI) of the feature.
param
state The requested state of the feature (true or false).
exception
org.apache.xerces.xni.parser.XMLConfigurationException If the requested feature is not known.

        
        fConfigUpdated = true;
        
        // forward to every XML 1.0 component
        fNamespaceScanner.setFeature(featureId, state);
        fDTDScanner.setFeature(featureId, state);
        
        // forward to every XML 1.1 component
        if (f11Initialized) {
            try {
                fXML11DTDScanner.setFeature(featureId, state);
            }
            // ignore the exception.
            catch (Exception e) {}
            try {
                fXML11NSDocScanner.setFeature(featureId, state);
            }
            // ignore the exception
            catch (Exception e) {}
        }
        
        // save state if noone "objects"
        super.setFeature(featureId, state);

    
public voidsetInputSource(org.apache.xerces.xni.parser.XMLInputSource inputSource)
Sets the input source for the document to parse.

param
inputSource The document's input source.
exception
XMLConfigurationException Thrown if there is a configuration error when initializing the parser.
exception
IOException Thrown on I/O error.
see
#parse(boolean)

        
        // REVISIT: this method used to reset all the components and
        //          construct the pipeline. Now reset() is called
        //          in parse (boolean) just before we parse the document
        //          Should this method still throw exceptions..?
        
        fInputSource = inputSource;
        
    
public voidsetLocale(java.util.Locale locale)
Set the locale to use for messages.

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

        super.setLocale(locale);
        fErrorReporter.setLocale(locale);
    
public voidsetProperty(java.lang.String propertyId, java.lang.Object value)
setProperty

param
propertyId
param
value

        
        fConfigUpdated = true;

        // forward to every XML 1.0 component
        fNamespaceScanner.setProperty(propertyId, value);
        fDTDScanner.setProperty(propertyId, value);
        
        // forward to every XML 1.1 component
        if (f11Initialized) {
            try {
                fXML11DTDScanner.setProperty(propertyId, value);
            }
            // ignore the exception.
            catch (Exception e) {}
            try {
                fXML11NSDocScanner.setProperty(propertyId, value);
            }
            // ignore the exception
            catch (Exception e) {}
        }

        // store value if noone "objects"
        super.setProperty(propertyId, value);