XIncludeHandler
in the pipeline
* before the schema validator, or as the last component in the pipeline if there is
* no schema validator. Using this pipeline will enable processing according to the
* XML Inclusions specification, to the conformance level described in
* XIncludeHandler
.
*
* @author Peter McCracken, IBM
* @author Arun Yadav, Sun Microsystem
* @see com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler
*/
public class XIncludeParserConfiguration extends XML11Configuration {
private XIncludeHandler fXIncludeHandler;
/** Feature identifier: allow notation and unparsed entity events to be sent out of order. */
protected static final String ALLOW_UE_AND_NOTATION_EVENTS =
Constants.SAX_FEATURE_PREFIX + Constants.ALLOW_DTD_EVENTS_AFTER_ENDDTD_FEATURE;
/** Feature identifier: XInclude Aware */
protected static final String XINCLUDE_AWARE =
Constants.XERCES_FEATURE_PREFIX + Constants.XINCLUDE_AWARE ;
/** Property identifier: error reporter. */
protected static final String XINCLUDE_HANDLER =
Constants.XERCES_PROPERTY_PREFIX + Constants.XINCLUDE_HANDLER_PROPERTY;
/** Property identifier: error reporter. */
protected static final String NAMESPACE_CONTEXT =
Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
private boolean enableXInclude = false;
/** Default constructor. */
public XIncludeParserConfiguration() {
this(null, null, null);
} //
*
* @param symbolTable The symbol table to use.
* @param grammarPool The grammar pool to use.
*/
public XIncludeParserConfiguration(
SymbolTable symbolTable,
XMLGrammarPool grammarPool) {
this(symbolTable, grammarPool, null);
} //
*
* @param symbolTable The symbol table to use.
* @param grammarPool The grammar pool to use.
* @param parentSettings The parent settings.
*/
public XIncludeParserConfiguration(
SymbolTable symbolTable,
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
super(symbolTable, grammarPool, parentSettings);
//add default recognized features
final String[] recognizedFeatures = {
ALLOW_UE_AND_NOTATION_EVENTS,
XINCLUDE_AWARE
};
addRecognizedFeatures(recognizedFeatures);
// add default recognized properties
fXIncludeHandler = new XIncludeHandler();
addComponent(fXIncludeHandler);
final String[] recognizedProperties = {
XINCLUDE_HANDLER,
NAMESPACE_CONTEXT
};
addRecognizedProperties(recognizedProperties);
setProperty(XINCLUDE_HANDLER, fXIncludeHandler);
setProperty(NAMESPACE_CONTEXT, new XIncludeNamespaceSupport());
setFeature(ALLOW_UE_AND_NOTATION_EVENTS, true);
setFeature(XINCLUDE_AWARE, false);
} //