Java Code Examples for com.sun.org.apache.xerces.internal.util.FeatureState#NOT_SUPPORTED

The following examples show how to use com.sun.org.apache.xerces.internal.util.FeatureState#NOT_SUPPORTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicParserConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // Xerces Features
    //
    if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
        final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();

        //
        // special performance feature: no one by component manager is allowed to set it
        //
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    return super.checkFeature(featureId);
 }
 
Example 2
Source File: BasicParserConfiguration.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // Xerces Features
    //
    if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
        final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();

        //
        // special performance feature: no one by component manager is allowed to set it
        //
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    return super.checkFeature(featureId);
 }
 
Example 3
Source File: BasicParserConfiguration.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // Xerces Features
    //
    if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
        final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();

        //
        // special performance feature: no one by component manager is allowed to set it
        //
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    return super.checkFeature(featureId);
 }
 
Example 4
Source File: BasicParserConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // Xerces Features
    //
    if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
        final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();

        //
        // special performance feature: no one by component manager is allowed to set it
        //
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    return super.checkFeature(featureId);
 }
 
Example 5
Source File: BasicParserConfiguration.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // Xerces Features
    //
    if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
        final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();

        //
        // special performance feature: no one by component manager is allowed to set it
        //
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    return super.checkFeature(featureId);
 }
 
Example 6
Source File: DTDConfiguration.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 7
Source File: DTDConfiguration.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 8
Source File: SchemaParsingConfig.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
                featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 9
Source File: XML11NonValidatingConfiguration.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }

        // special performance feature: only component manager is allowed to set it.
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 10
Source File: XML11DTDConfiguration.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }

        // special performance feature: only component manager is allowed to set it.
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 11
Source File: XML11DTDConfiguration.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }

        // special performance feature: only component manager is allowed to set it.
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 12
Source File: DTDConfiguration.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 13
Source File: XML11NonValidatingConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }

        // special performance feature: only component manager is allowed to set it.
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 14
Source File: DTDConfiguration.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 15
Source File: XML11DTDConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }

        // special performance feature: only component manager is allowed to set it.
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 16
Source File: SchemaParsingConfig.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
                featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 17
Source File: DTDConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 18
Source File: NonValidatingConfiguration.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId)
    throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 19
Source File: XML11NonValidatingConfiguration.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }

        // special performance feature: only component manager is allowed to set it.
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}
 
Example 20
Source File: XML11NonValidatingConfiguration.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * 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.
 */
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException {

    //
    // 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 FeatureState.RECOGNIZED;
        }

        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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
            return FeatureState.NOT_SUPPORTED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }
        //
        // 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 FeatureState.RECOGNIZED;
        }

        //
        // http://apache.org/xml/features/validation/default-attribute-values
        //
        if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
            featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
            return FeatureState.NOT_SUPPORTED;
        }

        // special performance feature: only component manager is allowed to set it.
        if (suffixLength == Constants.PARSER_SETTINGS.length() &&
            featureId.endsWith(Constants.PARSER_SETTINGS)) {
            return FeatureState.NOT_SUPPORTED;
        }
    }

    //
    // Not recognized
    //

    return super.checkFeature(featureId);

}