/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This is the "standard" parser configuration. It extends the DTD
* configuration with the standard set of parser components.
* The standard set of parser components include those needed
* to parse and validate with DTD's, and those needed for XML
* Schema.</p>
* <p>
* In addition to the features and properties recognized by the base
* parser configuration, this class recognizes these additional
* features and properties:
* <ul>
* <li>Features
* <ul>
* </ul>
* <li>Properties
* <ul>
* </ul>
* </ul>
*
* @author Arnaud Le Hors, IBM
* @author Andy Clark, IBM
*
* @version $Id: StandardParserConfiguration.java,v 1.7 2010-11-01 04:40:10 joehw Exp $
*/
public class StandardParserConfiguration
extends DTDConfiguration {
//
// Constants
//
// feature identifiers
/** Feature identifier: expose schema normalized value */
/** Feature identifier: send element default value via characters() */
/** Feature identifier: augment PSVI */
/** feature identifier: XML Schema validation */
/** feature identifier: XML Schema validation -- full checking */
/** Feature: generate synthetic annotations */
/** Feature identifier: validate annotations */
/** Feature identifier: honour all schemaLocations */
/** Feature identifier: namespace growth */
/** Feature identifier: tolerate duplicates */
// property identifiers
/** Property identifier: XML Schema validator. */
/** Property identifier: schema location. */
/** Property identifier: no namespace schema location. */
/** Property identifier: Schema DV Factory */
//
// Data
//
// components (non-configurable)
/** XML Schema Validator. */
//
// Constructors
//
/** Default constructor. */
public StandardParserConfiguration() {
} // <init>()
/**
* Constructs a parser configuration using the specified symbol table.
*
* @param symbolTable The symbol table to use.
*/
} // <init>(SymbolTable)
/**
* Constructs a parser configuration using the specified symbol table and
* grammar pool.
* <p>
* <strong>REVISIT:</strong>
* 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.
*/
} // <init>(SymbolTable,XMLGrammarPool)
/**
* Constructs a parser configuration using the specified symbol table,
* grammar pool, and parent settings.
* <p>
* <strong>REVISIT:</strong>
* 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.
*/
// add default recognized features
final String[] recognizedFeatures = {
// 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
};
// set state for default features
setFeature(SCHEMA_ELEMENT_DEFAULT, true);
setFeature(NORMALIZE_DATA, true);
setFeature(SCHEMA_AUGMENT_PSVI, true);
setFeature(GENERATE_SYNTHETIC_ANNOTATIONS, false);
setFeature(VALIDATE_ANNOTATIONS, false);
setFeature(HONOUR_ALL_SCHEMALOCATIONS, false);
setFeature(NAMESPACE_GROWTH, false);
setFeature(TOLERATE_DUPLICATES, false);
// add default recognized properties
final String[] recognizedProperties = {
// 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
};
} // <init>(SymbolTable,XMLGrammarPool)
//
// Public methods
//
/** Configures the pipeline. */
protected void configurePipeline() {
super.configurePipeline();
if ( getFeature(XMLSCHEMA_VALIDATION )) {
// If schema validator was not in the pipeline insert it.
if (fSchemaValidator == null) {
fSchemaValidator = new XMLSchemaValidator();
// add schema component
// add schema message formatter
}
}
}
} // configurePipeline()
// features and properties
/**
* 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 <strong>really</strong>
* a critical error.
*/
throws XMLConfigurationException {
//
// Xerces Features
//
//
//
return FeatureState.RECOGNIZED;
}
// activate full schema checking
return FeatureState.RECOGNIZED;
}
// Feature identifier: expose schema normalized value
return FeatureState.RECOGNIZED;
}
// Feature identifier: send element default value via characters()
return FeatureState.RECOGNIZED;
}
}
//
// Not recognized
//
return super.checkFeature(featureId);
} // checkFeature(String)
/**
* 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 <strong>really</strong>
* a critical error.
*/
throws XMLConfigurationException {
//
// Xerces Properties
//
return PropertyState.RECOGNIZED;
}
return PropertyState.RECOGNIZED;
}
}
return PropertyState.RECOGNIZED;
}
}
//
// Not recognized
//
return super.checkProperty(propertyId);
} // checkProperty(String)
} // class StandardParserConfiguration