FileDocCategorySizeDatePackage
XML11Configuration.javaAPI DocJava SE 6 API58447Tue Jun 10 00:22:50 BST 2008com.sun.org.apache.xerces.internal.parsers

XML11Configuration

public class XML11Configuration extends ParserConfigurationSettings implements XML11Configurable, XMLPullParserConfiguration
This class is the configuration used to parse XML 1.0 and XML 1.1 documents.
author
Elena Litani, IBM
author
Neil Graham, IBM
author
Michael Glavassevich, IBM
version
$Id: XML11Configuration.java,v 1.2.6.1 2005/09/07 07:40:18 sunithareddy Exp $

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_DUPLICATE_ENTITYDEF
Feature identifier: warn on duplicate entity 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
SCHEMA_AUGMENT_PSVI
Feature identifier: augment PSVI
protected static final String
XMLSCHEMA_VALIDATION
feature identifier: XML Schema validation
protected static final String
XMLSCHEMA_FULL_CHECKING
feature identifier: XML Schema validation -- full checking
protected static final String
GENERATE_SYNTHETIC_ANNOTATIONS
Feature: generate synthetic annotations
protected static final String
VALIDATE_ANNOTATIONS
Feature identifier: validate annotations
protected static final String
HONOUR_ALL_SCHEMALOCATIONS
Feature identifier: honour all schemaLocations
protected static final String
USE_GRAMMAR_POOL_ONLY
Feature identifier: use grammar pool only
protected static final String
VALIDATION
Feature identifier: validation.
protected static final String
NAMESPACES
Feature identifier: namespaces.
protected static final String
EXTERNAL_GENERAL_ENTITIES
Feature identifier: external general entities.
protected static final String
EXTERNAL_PARAMETER_ENTITIES
Feature identifier: external parameter entities.
protected static final String
XML_STRING
Property identifier: xml string.
protected static final String
SYMBOL_TABLE
Property identifier: symbol table.
protected static final String
ERROR_HANDLER
Property identifier: error handler.
protected static final String
ENTITY_RESOLVER
Property identifier: entity resolver.
protected static final String
SCHEMA_VALIDATOR
Property identifier: XML Schema validator.
protected static final String
SCHEMA_LOCATION
Property identifier: schema location.
protected static final String
SCHEMA_NONS_LOCATION
Property identifier: no namespace schema location.
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_PROCESSOR
Property identifier: DTD loader.
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
JAXP_SCHEMA_LANGUAGE
Property identifier: JAXP schema language / DOM schema-type.
protected static final String
JAXP_SCHEMA_SOURCE
Property identifier: JAXP schema source/ DOM schema-location.
protected static final boolean
PRINT_EXCEPTION_STACK_TRACE
Set to true and recompile to print exception stack trace.
protected SymbolTable
fSymbolTable
protected XMLInputSource
fInputSource
protected ValidationManager
fValidationManager
protected XMLVersionDetector
fVersionDetector
protected XMLLocator
fLocator
protected Locale
fLocale
protected ArrayList
fComponents
XML 1.0 Components.
protected ArrayList
fXML11Components
XML 1.1. Components.
protected ArrayList
fCommonComponents
Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator
protected XMLDocumentHandler
fDocumentHandler
The document handler.
protected XMLDTDHandler
fDTDHandler
The DTD handler.
protected XMLDTDContentModelHandler
fDTDContentModelHandler
The DTD content model handler.
protected XMLDocumentSource
fLastComponent
Last component in the document pipeline
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.
protected DTDDVFactory
fDatatypeValidatorFactory
The XML 1.0 Datatype validator factory.
protected XMLNSDocumentScannerImpl
fNamespaceScanner
The XML 1.0 Document scanner that does namespace binding.
protected XMLDocumentScannerImpl
fNonNSScanner
The XML 1.0 Non-namespace implementation of scanner
protected XMLDTDValidator
fDTDValidator
The XML 1.0 DTD Validator: binds namespaces
protected XMLDTDValidator
fNonNSDTDValidator
The XML 1.0 DTD Validator that does not bind namespaces
protected XMLDTDScanner
fDTDScanner
The XML 1.0 DTD scanner.
protected XMLDTDProcessor
fDTDProcessor
The XML 1.0 DTD Processor .
protected DTDDVFactory
fXML11DatatypeFactory
The XML 1.1 datatype factory.
protected XML11NSDocumentScannerImpl
fXML11NSDocScanner
The XML 1.1 document scanner that does namespace binding.
protected XML11DocumentScannerImpl
fXML11DocScanner
The XML 1.1 document scanner that does not do namespace binding.
protected XML11NSDTDValidator
fXML11NSDTDValidator
The XML 1.1 DTD validator that does namespace binding.
protected XML11DTDValidator
fXML11DTDValidator
The XML 1.1 DTD validator that does not do namespace binding.
protected XML11DTDScannerImpl
fXML11DTDScanner
The XML 1.1 DTD scanner.
protected XML11DTDProcessor
fXML11DTDProcessor
The XML 1.1 DTD processor.
protected XMLGrammarPool
fGrammarPool
Grammar pool.
protected XMLErrorReporter
fErrorReporter
Error reporter.
protected XMLEntityManager
fEntityManager
Entity manager.
protected XMLSchemaValidator
fSchemaValidator
XML Schema Validator.
protected XMLDocumentScanner
fCurrentScanner
Current scanner
protected DTDDVFactory
fCurrentDVFactory
Current Datatype validator factory.
protected XMLDTDScanner
fCurrentDTDScanner
Current DTD scanner.
private boolean
f11Initialized
Flag indiciating whether XML11 components have been initialized.
Constructors Summary
public XML11Configuration()
Default constructor.


    //
    // Constructors
    //

       
      
        this(null, null, null);
    
public XML11Configuration(SymbolTable symbolTable)
Constructs a parser configuration using the specified symbol table.

param
symbolTable The symbol table to use.

        this(symbolTable, null, null);
    
public XML11Configuration(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.

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

        this(symbolTable, grammarPool, null);
    
public XML11Configuration(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.

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

		
		super(parentSettings);

		// create a vector to hold all the components in use
		// XML 1.0 specialized components
		fComponents = new ArrayList();
		// XML 1.1 specialized components
		fXML11Components = new ArrayList();
		// Common components for XML 1.1. and XML 1.0
		fCommonComponents = new ArrayList();

		// create storage for recognized features and properties
		fRecognizedFeatures = new ArrayList();
		fRecognizedProperties = new ArrayList();

		// create table for features and properties
		fFeatures = new HashMap();
		fProperties = new HashMap();

        // add default recognized features
        final String[] recognizedFeatures =
            {   
            	CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl
				VALIDATION,                 
				NAMESPACES,
                NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI,
                GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS,
                HONOUR_ALL_SCHEMALOCATIONS, USE_GRAMMAR_POOL_ONLY,
            	// NOTE: These shouldn't really be here but since the XML Schema
            	//       validator is constructed dynamically, its recognized
            	//       features might not have been set and it would cause a
            	//       not-recognized exception to be thrown. -Ac
            	XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING, 			
				EXTERNAL_GENERAL_ENTITIES,  
				EXTERNAL_PARAMETER_ENTITIES,
				PARSER_SETTINGS
			};
        addRecognizedFeatures(recognizedFeatures);
		// set state for default features
		fFeatures.put(VALIDATION, Boolean.FALSE);
		fFeatures.put(NAMESPACES, Boolean.TRUE);
		fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
		fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
		fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
		fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
		fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE);
		fFeatures.put(NORMALIZE_DATA, Boolean.TRUE);
		fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
        fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
        fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
        fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
        fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
		fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);

        // add default recognized properties
        final String[] recognizedProperties =
            {				     
				SYMBOL_TABLE,
				ERROR_HANDLER,  
				ENTITY_RESOLVER,
                ERROR_REPORTER,
                ENTITY_MANAGER,
                DOCUMENT_SCANNER,
                DTD_SCANNER,
                DTD_PROCESSOR,
                DTD_VALIDATOR,
				DATATYPE_VALIDATOR_FACTORY,
				VALIDATION_MANAGER,
				SCHEMA_VALIDATOR,
				XML_STRING,
                XMLGRAMMAR_POOL, 
                JAXP_SCHEMA_SOURCE,
                JAXP_SCHEMA_LANGUAGE,                
            	// NOTE: These shouldn't really be here but since the XML Schema
            	//       validator is constructed dynamically, its recognized
            	//       properties might not have been set and it would cause a
            	//       not-recognized exception to be thrown. -Ac
            	SCHEMA_LOCATION, SCHEMA_NONS_LOCATION, };
        addRecognizedProperties(recognizedProperties);
		
		if (symbolTable == null) {
			symbolTable = new SymbolTable();
		}
		fSymbolTable = symbolTable;
		fProperties.put(SYMBOL_TABLE, fSymbolTable);
		
        fGrammarPool = grammarPool;
        if (fGrammarPool != null) {
			fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
        }

        fEntityManager = new XMLEntityManager();
		fProperties.put(ENTITY_MANAGER, fEntityManager);
        addCommonComponent(fEntityManager);

        fErrorReporter = new XMLErrorReporter();
        fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
		fProperties.put(ERROR_REPORTER, fErrorReporter);
        addCommonComponent(fErrorReporter);

        fNamespaceScanner = new XMLNSDocumentScannerImpl();
		fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
        addComponent((XMLComponent) fNamespaceScanner);

        fDTDScanner = new XMLDTDScannerImpl();
		fProperties.put(DTD_SCANNER, fDTDScanner);
        addComponent((XMLComponent) fDTDScanner);

        fDTDProcessor = new XMLDTDProcessor();
		fProperties.put(DTD_PROCESSOR, fDTDProcessor);
        addComponent((XMLComponent) fDTDProcessor);

        fDTDValidator = new XMLNSDTDValidator();
		fProperties.put(DTD_VALIDATOR, fDTDValidator);
        addComponent(fDTDValidator);

        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);
        }

        // set locale
        try {
            setLocale(Locale.getDefault());
        } catch (XNIException e) {
            // do nothing
            // REVISIT: What is the right thing to do? -Ac
        }
        
		fConfigUpdated = false;

    
Methods Summary
protected voidaddCommonComponent(com.sun.org.apache.xerces.internal.xni.parser.XMLComponent component)
Adds common component to the parser configuration. This method will also add all of the component's recognized features and properties to the list of default recognized features and properties.

param
component The component to add.


        // don't add a component more than once
        if (fCommonComponents.contains(component)) {
            return;
        }
        fCommonComponents.add(component);
        addRecognizedParamsAndSetDefaults(component);

    
protected voidaddComponent(com.sun.org.apache.xerces.internal.xni.parser.XMLComponent component)
Adds a component to the parser configuration. This method will also add all of the component's recognized features and properties to the list of default recognized features and properties.

param
component The component to add.


        // don't add a component more than once
        if (fComponents.contains(component)) {
            return;
        }
        fComponents.add(component);
        addRecognizedParamsAndSetDefaults(component);
	
    
protected voidaddRecognizedParamsAndSetDefaults(com.sun.org.apache.xerces.internal.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 voidaddXML11Component(com.sun.org.apache.xerces.internal.xni.parser.XMLComponent component)
Adds an XML 1.1 component to the parser configuration. This method will also add all of the component's recognized features and properties to the list of default recognized features and properties.

param
component The component to add.


        // don't add a component more than once
        if (fXML11Components.contains(component)) {
            return;
        }
        fXML11Components.add(component);
        addRecognizedParamsAndSetDefaults(component);
        
    
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);
            }
            
            //
            // http://apache.org/xml/features/validation/schema
            //   Lets the user turn Schema validation support on/off.
            //
            if (suffixLength == Constants.SCHEMA_VALIDATION_FEATURE.length() && 
                featureId.endsWith(Constants.SCHEMA_VALIDATION_FEATURE)) {
                return;
            }
            // activate full schema checking
            if (suffixLength == Constants.SCHEMA_FULL_CHECKING.length() && 
                featureId.endsWith(Constants.SCHEMA_FULL_CHECKING)) {
                return;
            }
            // Feature identifier: expose schema normalized value 
            //  http://apache.org/xml/features/validation/schema/normalized-value
            if (suffixLength == Constants.SCHEMA_NORMALIZED_VALUE.length() && 
                featureId.endsWith(Constants.SCHEMA_NORMALIZED_VALUE)) {
                return;
            } 
            // Feature identifier: send element default value via characters() 
            // http://apache.org/xml/features/validation/schema/element-default
            if (suffixLength == Constants.SCHEMA_ELEMENT_DEFAULT.length() && 
                featureId.endsWith(Constants.SCHEMA_ELEMENT_DEFAULT)) {
                return;
            }
			 
            // special performance feature: only component manager is allowed to set it.			 
            if (suffixLength == Constants.PARSER_SETTINGS.length() && 
                featureId.endsWith(Constants.PARSER_SETTINGS)) {
                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 (suffixLength == Constants.SCHEMA_LOCATION.length() && 
                propertyId.endsWith(Constants.SCHEMA_LOCATION)) {
                return;
            }
            if (suffixLength == Constants.SCHEMA_NONS_LOCATION.length() && 
                propertyId.endsWith(Constants.SCHEMA_NONS_LOCATION)) {
                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;
            }
        }
		
        // special cases
        if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
            final int suffixLength = propertyId.length() - Constants.SAX_PROPERTY_PREFIX.length();
			
            //
            // http://xml.org/sax/properties/xml-string
            // Value type: String
            // Access: read-only
            //   Get the literal string of characters associated with the
            //   current event.  If the parser recognises and supports this
            //   property but is not currently parsing text, it should return
            //   null (this is a good way to check for availability before the
            //   parse begins).
            //
            if (suffixLength == Constants.XML_STRING_PROPERTY.length() && 
                propertyId.endsWith(Constants.XML_STRING_PROPERTY)) {
                // REVISIT - we should probably ask xml-dev for a precise
                // definition of what this is actually supposed to return, and
                // in exactly which circumstances.
                short type = XMLConfigurationException.NOT_SUPPORTED;
                throw new XMLConfigurationException(type, propertyId);
            }
        }

        //
        // 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 pipeline.

        if (fCurrentDVFactory != fDatatypeValidatorFactory) {
            fCurrentDVFactory = fDatatypeValidatorFactory;
            // use XML 1.0 datatype library
            setProperty(DATATYPE_VALIDATOR_FACTORY, fCurrentDVFactory);
        }

        // setup DTD pipeline
        if (fCurrentDTDScanner != fDTDScanner) {
            fCurrentDTDScanner = fDTDScanner;
            setProperty(DTD_SCANNER, fCurrentDTDScanner);
            setProperty(DTD_PROCESSOR, fDTDProcessor);
        }
        fDTDScanner.setDTDHandler(fDTDProcessor);
        fDTDProcessor.setDTDSource(fDTDScanner);
        fDTDProcessor.setDTDHandler(fDTDHandler);
        if (fDTDHandler != null) {
            fDTDHandler.setDTDSource(fDTDProcessor);
        }

        fDTDScanner.setDTDContentModelHandler(fDTDProcessor);
        fDTDProcessor.setDTDContentModelSource(fDTDScanner);
        fDTDProcessor.setDTDContentModelHandler(fDTDContentModelHandler);
        if (fDTDContentModelHandler != null) {
            fDTDContentModelHandler.setDTDContentModelSource(fDTDProcessor);
        }

        // setup document pipeline
        if (fFeatures.get(NAMESPACES) == Boolean.TRUE) {
            if (fCurrentScanner != fNamespaceScanner) {
                fCurrentScanner = fNamespaceScanner;
                setProperty(DOCUMENT_SCANNER, fNamespaceScanner);
                setProperty(DTD_VALIDATOR, fDTDValidator);
            }
            fNamespaceScanner.setDTDValidator(fDTDValidator);
            fNamespaceScanner.setDocumentHandler(fDTDValidator);
            fDTDValidator.setDocumentSource(fNamespaceScanner);
            fDTDValidator.setDocumentHandler(fDocumentHandler);
            if (fDocumentHandler != null) {
                fDocumentHandler.setDocumentSource(fDTDValidator);
            }
            fLastComponent = fDTDValidator;
        } else {
            // create components
            if (fNonNSScanner == null) {
                fNonNSScanner = new XMLDocumentScannerImpl();
                fNonNSDTDValidator = new XMLDTDValidator();
                // add components
                addComponent((XMLComponent) fNonNSScanner);
                addComponent((XMLComponent) fNonNSDTDValidator);
            }
            if (fCurrentScanner != fNonNSScanner) {
                fCurrentScanner = fNonNSScanner;
                setProperty(DOCUMENT_SCANNER, fNonNSScanner);
                setProperty(DTD_VALIDATOR, fNonNSDTDValidator);
            }

            fNonNSScanner.setDocumentHandler(fNonNSDTDValidator);
            fNonNSDTDValidator.setDocumentSource(fNonNSScanner);
            fNonNSDTDValidator.setDocumentHandler(fDocumentHandler);
            if (fDocumentHandler != null) {
                fDocumentHandler.setDocumentSource(fNonNSDTDValidator);
            }
            fLastComponent = fNonNSDTDValidator;
        }

        // add XML Schema validator if needed
        if (fFeatures.get(XMLSCHEMA_VALIDATION) == Boolean.TRUE) {
            // If schema validator was not in the pipeline insert it.
            if (fSchemaValidator == null) {
                fSchemaValidator = new XMLSchemaValidator();
                // add schema component
                setProperty(SCHEMA_VALIDATOR, fSchemaValidator);
                addCommonComponent(fSchemaValidator);
                fSchemaValidator.reset(this);
                // add schema message formatter
                if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
                    XSMessageFormatter xmft = new XSMessageFormatter();
                    fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
                }

            }
            fLastComponent.setDocumentHandler(fSchemaValidator);
            fSchemaValidator.setDocumentSource(fLastComponent);
            fSchemaValidator.setDocumentHandler(fDocumentHandler);
            if (fDocumentHandler != null) {
                fDocumentHandler.setDocumentSource(fSchemaValidator);
            }
            fLastComponent = fSchemaValidator;
        }
    
protected voidconfigureXML11Pipeline()
Configures the XML 1.1 pipeline. Note: this method also resets the new XML11 components.

        if (fCurrentDVFactory != fXML11DatatypeFactory) {
            fCurrentDVFactory = fXML11DatatypeFactory;
            setProperty(DATATYPE_VALIDATOR_FACTORY, fCurrentDVFactory);
        }
        if (fCurrentDTDScanner != fXML11DTDScanner) {
            fCurrentDTDScanner = fXML11DTDScanner;
            setProperty(DTD_SCANNER, fCurrentDTDScanner);
			setProperty(DTD_PROCESSOR, fXML11DTDProcessor);
        }

        fXML11DTDScanner.setDTDHandler(fXML11DTDProcessor);
        fXML11DTDProcessor.setDTDSource(fXML11DTDScanner);
        fXML11DTDProcessor.setDTDHandler(fDTDHandler);
        if (fDTDHandler != null) {
            fDTDHandler.setDTDSource(fXML11DTDProcessor);
        }

        fXML11DTDScanner.setDTDContentModelHandler(fXML11DTDProcessor);
        fXML11DTDProcessor.setDTDContentModelSource(fXML11DTDScanner);
        fXML11DTDProcessor.setDTDContentModelHandler(fDTDContentModelHandler);
        if (fDTDContentModelHandler != null) {
            fDTDContentModelHandler.setDTDContentModelSource(fXML11DTDProcessor);
        }

        // setup XML 1.1 document pipeline
        if (fFeatures.get(NAMESPACES) == Boolean.TRUE) {
            if (fCurrentScanner != fXML11NSDocScanner) {
                fCurrentScanner = fXML11NSDocScanner;
                setProperty(DOCUMENT_SCANNER, fXML11NSDocScanner);
                setProperty(DTD_VALIDATOR, fXML11NSDTDValidator);
            }

            fXML11NSDocScanner.setDTDValidator(fXML11NSDTDValidator);
            fXML11NSDocScanner.setDocumentHandler(fXML11NSDTDValidator);
            fXML11NSDTDValidator.setDocumentSource(fXML11NSDocScanner);
            fXML11NSDTDValidator.setDocumentHandler(fDocumentHandler);

            if (fDocumentHandler != null) {
                fDocumentHandler.setDocumentSource(fXML11NSDTDValidator);
            }
            fLastComponent = fXML11NSDTDValidator;

        } else {
			// create components
			  if (fXML11DocScanner == null) {
					// non namespace document pipeline
					fXML11DocScanner = new XML11DocumentScannerImpl();
					addXML11Component(fXML11DocScanner);
					fXML11DTDValidator = new XML11DTDValidator();
					addXML11Component(fXML11DTDValidator);
			  }
            if (fCurrentScanner != fXML11DocScanner) {
                fCurrentScanner = fXML11DocScanner;
                setProperty(DOCUMENT_SCANNER, fXML11DocScanner);
                setProperty(DTD_VALIDATOR, fXML11DTDValidator);
            }
            fXML11DocScanner.setDocumentHandler(fXML11DTDValidator);
            fXML11DTDValidator.setDocumentSource(fXML11DocScanner);
            fXML11DTDValidator.setDocumentHandler(fDocumentHandler);

            if (fDocumentHandler != null) {
                fDocumentHandler.setDocumentSource(fXML11DTDValidator);
            }
            fLastComponent = fXML11DTDValidator;
        }

        // setup document pipeline
        if (fFeatures.get(XMLSCHEMA_VALIDATION) == Boolean.TRUE) {
            // If schema validator was not in the pipeline insert it.
            if (fSchemaValidator == null) {
                fSchemaValidator = new XMLSchemaValidator();
                // add schema component
                setProperty(SCHEMA_VALIDATOR, fSchemaValidator);
				addCommonComponent(fSchemaValidator);
				fSchemaValidator.reset(this);
                // add schema message formatter
                if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
                    XSMessageFormatter xmft = new XSMessageFormatter();
                    fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
                }
            }

            fLastComponent.setDocumentHandler(fSchemaValidator);
            fSchemaValidator.setDocumentSource(fLastComponent);
            fSchemaValidator.setDocumentHandler(fDocumentHandler);
            if (fDocumentHandler != null) {
                fDocumentHandler.setDocumentSource(fSchemaValidator);
            }
            fLastComponent = fSchemaValidator;
        }

    
public com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandlergetDTDContentModelHandler()
Returns the registered DTD content model handler.

		return fDTDContentModelHandler;
	
public com.sun.org.apache.xerces.internal.xni.XMLDTDHandlergetDTDHandler()
Returns the registered DTD handler.

		return fDTDHandler;
	
public com.sun.org.apache.xerces.internal.xni.XMLDocumentHandlergetDocumentHandler()
Returns the registered document handler.

		return fDocumentHandler;
	
public com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolvergetEntityResolver()
Return the current entity resolver.

return
The current entity resolver, or null if none has been registered.
see
#setEntityResolver

		return (XMLEntityResolver)fProperties.get(ENTITY_RESOLVER);
	
public com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandlergetErrorHandler()
Return the current error handler.

return
The current error handler, or null if none has been registered.
see
#setErrorHandler

		// REVISIT: Should this be a property?
		return (XMLErrorHandler)fProperties.get(ERROR_HANDLER);
	
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);

	
booleangetFeature0(java.lang.String featureId)
Returns the state of a feature. This method calls getFeature() on ParserConfigurationSettings, bypassing getFeature() on this class.

        return super.getFeature(featureId);
    
public java.util.LocalegetLocale()
Returns the locale.

		return fLocale;
	
private voidinitXML11Components()

        if (!f11Initialized) {

            // create datatype factory
            fXML11DatatypeFactory = DTDDVFactory.getInstance(XML11_DATATYPE_VALIDATOR_FACTORY);

            // setup XML 1.1 DTD pipeline
            fXML11DTDScanner = new XML11DTDScannerImpl();
            addXML11Component(fXML11DTDScanner);
            fXML11DTDProcessor = new XML11DTDProcessor();
            addXML11Component(fXML11DTDProcessor);

            // setup XML 1.1. document pipeline - namespace aware
            fXML11NSDocScanner = new XML11NSDocumentScannerImpl();
            addXML11Component(fXML11NSDocScanner);
            fXML11NSDTDValidator = new XML11NSDTDValidator();
            addXML11Component(fXML11NSDTDValidator);
				
            f11Initialized = true;
        }
    
public voidparse(com.sun.org.apache.xerces.internal.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 booleanparse(boolean complete)

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

                short version = fVersionDetector.determineDocVersion(fInputSource);
                if (version == Constants.XML_VERSION_1_1) {
                    initXML11Components();
                    configureXML11Pipeline();
                    resetXML11();
                } else {
                    configurePipeline();
                    reset();
                }
                
                // 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);
        }

    
protected voidreset()
reset all XML 1.0 components before parsing and namespace context

		int count = fComponents.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fComponents.get(i);
			c.reset(this);
		}

	
protected voidresetCommon()
reset all common components before parsing

		// reset common components
		int count = fCommonComponents.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
			c.reset(this);
		}

	
protected voidresetXML11()
reset all components before parsing and namespace context

		// reset every component
		int count = fXML11Components.size();
		for (int i = 0; i < count; i++) {			
			XMLComponent c = (XMLComponent) fXML11Components.get(i);
			c.reset(this);
		}

	
public voidsetDTDContentModelHandler(com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler handler)
Sets the DTD content model handler.

param
handler The DTD content model handler.

		fDTDContentModelHandler = handler;
	
public voidsetDTDHandler(com.sun.org.apache.xerces.internal.xni.XMLDTDHandler dtdHandler)
Sets the DTD handler.

param
dtdHandler The DTD handler.

		fDTDHandler = dtdHandler;
	
public voidsetDocumentHandler(com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler documentHandler)
Sets the document handler on the last component in the pipeline to receive information about the document.

param
documentHandler The document handler.

		fDocumentHandler = documentHandler;
		if (fLastComponent != null) {
			fLastComponent.setDocumentHandler(fDocumentHandler);
			if (fDocumentHandler !=null){
				fDocumentHandler.setDocumentSource(fLastComponent);
			}
		}
	
public voidsetEntityResolver(com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver resolver)
Sets the resolver used to resolve external entities. The EntityResolver interface supports resolution of public and system identifiers.

param
resolver The new entity resolver. Passing a null value will uninstall the currently installed resolver.

		fProperties.put(ENTITY_RESOLVER, resolver);
	
public voidsetErrorHandler(com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler errorHandler)
Allow an application to register an error event handler.

If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.

param
errorHandler The error handler.
exception
java.lang.NullPointerException If the handler argument is null.
see
#getErrorHandler

		fProperties.put(ERROR_HANDLER, errorHandler);
	
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
com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the requested feature is not known.

		fConfigUpdated = true;
		// forward to every XML 1.0 component
		int count = fComponents.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fComponents.get(i);
			c.setFeature(featureId, state);
		}
		// forward it to common components
		count = fCommonComponents.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
			c.setFeature(featureId, state);
		}
				
		// forward to every XML 1.1 component
		count = fXML11Components.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fXML11Components.get(i);
			try{            
				c.setFeature(featureId, state);
			}
			catch (Exception e){
				// no op
			}
		}
		// save state if noone "objects"
		super.setFeature(featureId, state);

	
public voidsetInputSource(com.sun.org.apache.xerces.internal.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.

        fLocale = 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
		int count = fComponents.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fComponents.get(i);
			c.setProperty(propertyId, value);
		}
		// forward it to every common Component
		count = fCommonComponents.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
			c.setProperty(propertyId, value);
		}
		// forward it to every XML 1.1 component
		count = fXML11Components.size();
		for (int i = 0; i < count; i++) {
			XMLComponent c = (XMLComponent) fXML11Components.get(i);
			try{			
				c.setProperty(propertyId, value);
			}
			catch (Exception e){
				// ignore it
			}
		}

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