Java Code Examples for com.sun.org.apache.xerces.internal.impl.Constants#DOM_SUPPORTED_MEDIATYPES_ONLY

The following examples show how to use com.sun.org.apache.xerces.internal.impl.Constants#DOM_SUPPORTED_MEDIATYPES_ONLY . 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: DOMParserImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 2
Source File: DOMParserImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 3
Source File: DOMParserImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 4
Source File: DOMParserImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 5
Source File: DOMParserImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 6
Source File: DOMParserImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 7
Source File: DOMParserImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 8
Source File: DOMParserImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 9
Source File: DOMParserImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 10
Source File: DOMParserImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}
 
Example 11
Source File: DOMParserImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructs a DOM Builder using the specified parser configuration.
 */
public DOMParserImpl (XMLParserConfiguration config) {
    super (config);

    // add recognized features
    final String[] domRecognizedFeatures = {
        Constants.DOM_CANONICAL_FORM,
        Constants.DOM_CDATA_SECTIONS,
        Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING,
        Constants.DOM_INFOSET,
        Constants.DOM_NAMESPACE_DECLARATIONS,
        Constants.DOM_SPLIT_CDATA,
        Constants.DOM_SUPPORTED_MEDIATYPES_ONLY,
        Constants.DOM_CERTIFIED,
        Constants.DOM_WELLFORMED,
        Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS,
    };

    fConfiguration.addRecognizedFeatures (domRecognizedFeatures);

    // turn off deferred DOM
    fConfiguration.setFeature (DEFER_NODE_EXPANSION, false);

    // Set values so that the value of the
    // infoset parameter is true (its default value).
    //
    // true: namespace-declarations, well-formed,
    // element-content-whitespace, comments, namespaces
    //
    // false: validate-if-schema, entities,
    // datatype-normalization, cdata-sections

    fConfiguration.setFeature(Constants.DOM_NAMESPACE_DECLARATIONS, true);
    fConfiguration.setFeature(Constants.DOM_WELLFORMED, true);
    fConfiguration.setFeature(INCLUDE_COMMENTS_FEATURE, true);
    fConfiguration.setFeature(INCLUDE_IGNORABLE_WHITESPACE, true);
    fConfiguration.setFeature(NAMESPACES, true);

    fConfiguration.setFeature(DYNAMIC_VALIDATION, false);
    fConfiguration.setFeature(CREATE_ENTITY_REF_NODES, false);
    fConfiguration.setFeature(CREATE_CDATA_NODES_FEATURE, false);

    // set other default values
    fConfiguration.setFeature (Constants.DOM_CANONICAL_FORM, false);
    fConfiguration.setFeature (Constants.DOM_CHARSET_OVERRIDES_XML_ENCODING, true);
    fConfiguration.setFeature (Constants.DOM_SPLIT_CDATA, true);
    fConfiguration.setFeature (Constants.DOM_SUPPORTED_MEDIATYPES_ONLY, false);
    fConfiguration.setFeature (Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS, true);

    // REVISIT: by default Xerces assumes that input is certified.
    //          default is different from the one specified in the DOM spec
    fConfiguration.setFeature (Constants.DOM_CERTIFIED, true);

    // Xerces datatype-normalization feature is on by default
    // This is a recognized feature only for XML Schemas. If the
    // configuration doesn't support this feature, ignore it.
    try {
        fConfiguration.setFeature ( NORMALIZE_DATA, false );
    }
    catch (XMLConfigurationException exc) {}

}