本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.Constants.DOM_CANONICAL_FORM属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.DOM_CANONICAL_FORM属性的具体用法?Java Constants.DOM_CANONICAL_FORM怎么用?Java Constants.DOM_CANONICAL_FORM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xerces.internal.impl.Constants
的用法示例。
在下文中一共展示了Constants.DOM_CANONICAL_FORM属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DOMParserImpl
/**
* 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) {}
}