📄 domconfiguration.java
字号:
/* * Copyright (c) 2004 World Wide Web Consortium, * * (Massachusetts Institute of Technology, European Research Consortium for * Informatics and Mathematics, Keio University). All Rights Reserved. This * work is distributed under the W3C(r) Software License [1] in the hope that * it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 */package org.w3c.dom;/** * The <code>DOMConfiguration</code> interface represents the configuration * of a document and maintains a table of recognized parameters. Using the * configuration, it is possible to change * <code>Document.normalizeDocument()</code> behavior, such as replacing the * <code>CDATASection</code> nodes with <code>Text</code> nodes or * specifying the type of the schema that must be used when the validation * of the <code>Document</code> is requested. <code>DOMConfiguration</code> * objects are also used in [<a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>DOM Level 3 Load and Save</a>] * in the <code>DOMParser</code> and <code>DOMSerializer</code> interfaces. * <p> The parameter names used by the <code>DOMConfiguration</code> object * are defined throughout the DOM Level 3 specifications. Names are * case-insensitive. To avoid possible conflicts, as a convention, names * referring to parameters defined outside the DOM specification should be * made unique. Because parameters are exposed as properties in the , names * are recommended to follow the section 5.16 Identifiers of [Unicode] with the addition of the character '-' (HYPHEN-MINUS) but it is not * enforced by the DOM implementation. DOM Level 3 Core Implementations are * required to recognize all parameters defined in this specification. Some * parameter values may also be required to be supported by the * implementation. Refer to the definition of the parameter to know if a * value must be supported or not. * <p ><b>Note:</b> Parameters are similar to features and properties used in * SAX2 [<a href='http://www.saxproject.org/'>SAX</a>]. * <p> The following list of parameters defined in the DOM: * <dl> * <dt> * <code>"canonical-form"</code></dt> * <dd> * <dl> * <dt><code>true</code></dt> * <dd>[<em>optional</em>] Canonicalize the document according to the rules specified in [<a href='http://www.w3.org/TR/2001/REC-xml-c14n-20010315'>Canonical XML</a>], * such as removing the <code>DocumentType</code> node (if any) from the * tree, or removing superfluous namespace declarations from each element. * Note that this is limited to what can be represented in the DOM; in * particular, there is no way to specify the order of the attributes in the * DOM. In addition, Setting this parameter to <code>true</code> will also * set the state of the parameters listed below. Later changes to the state * of one of those parameters will revert "canonical-form" back to * <code>false</code>. Parameters set to <code>false</code>: "entities", " * normalize-characters", "cdata-sections". Parameters set to * <code>true</code>: "namespaces", "namespace-declarations", "well-formed", * "element-content-whitespace". Other parameters are not changed unless * explicitly specified in the description of the parameters.</dd> * <dt> * <code>false</code></dt> * <dd>[<em>required</em>] (<em>default</em>)Do not canonicalize the document.</dd> * </dl></dd> * <dt><code>"cdata-sections"</code></dt> * <dd> * <dl> * <dt> * <code>true</code></dt> * <dd>[<em>required</em>] (<em>default</em>)Keep <code>CDATASection</code> nodes in the document.</dd> * <dt><code>false</code></dt> * <dd>[<em>required</em>]Transform <code>CDATASection</code> nodes in the document into * <code>Text</code> nodes. The new <code>Text</code> node is then combined * with any adjacent <code>Text</code> node.</dd> * </dl></dd> * <dt> * <code>"check-character-normalization"</code></dt> * <dd> * <dl> * <dt><code>true</code></dt> * <dd>[<em>optional</em>] Check if the characters in the document are <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully * normalized</a>, as defined in appendix B of [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. When a * sequence of characters is encountered that fails normalization checking, * an error with the <code>DOMError.type</code> equals to * "check-character-normalization-failure" is issued. </dd> * <dt><code>false</code></dt> * <dd>[<em>required</em>] (<em>default</em>)Do not check if characters are normalized.</dd> * </dl></dd> * <dt><code>"comments"</code></dt> * <dd> * <dl> * <dt> * <code>true</code></dt> * <dd>[<em>required</em>] (<em>default</em>)Keep <code>Comment</code> nodes in the document.</dd> * <dt><code>false</code></dt> * <dd>[<em>required</em>]Discard <code>Comment</code> nodes in the document.</dd> * </dl></dd> * <dt> * <code>"datatype-normalization"</code></dt> * <dd> * <dl> * <dt><code>true</code></dt> * <dd>[<em>optional</em>] Expose schema normalized values in the tree, such as <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-nv'>XML * Schema normalized values</a> in the case of XML Schema. Since this parameter requires to have schema * information, the "validate" parameter will also be set to * <code>true</code>. Having this parameter activated when "validate" is * <code>false</code> has no effect and no schema-normalization will happen. * <p ><b>Note:</b> Since the document contains the result of the XML 1.0 * processing, this parameter does not apply to attribute value * normalization as defined in section 3.3.3 of [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] and is only * meant for schema languages other than Document Type Definition (DTD). </dd> * <dt> * <code>false</code></dt> * <dd>[<em>required</em>] (<em>default</em>) Do not perform schema normalization on the tree. </dd> * </dl></dd> * <dt> * <code>"element-content-whitespace"</code></dt> * <dd> * <dl> * <dt><code>true</code></dt> * <dd>[<em>required</em>] (<em>default</em>)Keep all whitespaces in the document.</dd> * <dt><code>false</code></dt> * <dd>[<em>optional</em>] Discard all <code>Text</code> nodes that contain whitespaces in element * content, as described in <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'> * [element content whitespace]</a>. The implementation is expected to use the attribute * <code>Text.isElementContentWhitespace</code> to determine if a * <code>Text</code> node should be discarded or not.</dd> * </dl></dd> * <dt><code>"entities"</code></dt> * <dd> * <dl> * <dt> * <code>true</code></dt> * <dd>[<em>required</em>] (<em>default</em>)Keep <code>EntityReference</code> nodes in the document.</dd> * <dt> * <code>false</code></dt> * <dd>[<em>required</em>] Remove all <code>EntityReference</code> nodes from the document, * putting the entity expansions directly in their place. <code>Text</code> * nodes are normalized, as defined in <code>Node.normalize</code>. Only <a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204/#infoitem.rse'> * unexpanded entity references</a> are kept in the document. </dd> * </dl> * <p ><b>Note:</b> This parameter does not affect <code>Entity</code> nodes. </dd> * <dt> * <code>"error-handler"</code></dt> * <dd>[<em>required</em>] Contains a <code>DOMErrorHandler</code> object. If an error is * encountered in the document, the implementation will call back the * <code>DOMErrorHandler</code> registered using this parameter. The * implementation may provide a default <code>DOMErrorHandler</code> object. * When called, <code>DOMError.relatedData</code> will contain the closest * node to where the error occurred. If the implementation is unable to * determine the node where the error occurs, * <code>DOMError.relatedData</code> will contain the <code>Document</code> * node. Mutations to the document from within an error handler will result * in implementation dependent behavior. </dd> * <dt><code>"infoset"</code></dt> * <dd> * <dl> * <dt> * <code>true</code></dt> * <dd>[<em>required</em>]Keep in the document the information defined in the XML Information Set [<a href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204/'>XML Information Set</a>] * .This forces the following parameters to <code>false</code>: " * validate-if-schema", "entities", "datatype-normalization", "cdata-sections * ".This forces the following parameters to <code>true</code>: " * namespace-declarations", "well-formed", "element-content-whitespace", " * comments", "namespaces".Other parameters are not changed unless * explicitly specified in the description of the parameters. Note that * querying this parameter with <code>getParameter</code> returns * <code>true</code> only if the individual parameters specified above are * appropriately set.</dd> * <dt><code>false</code></dt> * <dd>Setting <code>infoset</code> to * <code>false</code> has no effect.</dd> * </dl></dd> * <dt><code>"namespaces"</code></dt> * <dd> * <dl> * <dt> * <code>true</code></dt> * <dd>[<em>required</em>] (<em>default</em>) Perform the namespace processing as defined in . </dd> * <dt><code>false</code></dt> * <dd>[<em>optional</em>] Do not perform the namespace processing. </dd> * </dl></dd> * <dt> * <code>"namespace-declarations"</code></dt> * <dd> This parameter has no effect if the * parameter "namespaces" is set to <code>false</code>. * <dl> * <dt><code>true</code></dt> * <dd>[<em>required</em>] (<em>default</em>) Include namespace declaration attributes, specified or defaulted from * the schema, in the document. See also the sections "Declaring Namespaces" * in [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] * and [<a href='http://www.w3.org/TR/2004/REC-xml-names11-20040204/'>XML Namespaces 1.1</a>] * .</dd> * <dt><code>false</code></dt> * <dd>[<em>required</em>]Discard all namespace declaration attributes. The namespace prefixes ( * <code>Node.prefix</code>) are retained even if this parameter is set to * <code>false</code>.</dd> * </dl></dd> * <dt><code>"normalize-characters"</code></dt> * <dd> * <dl> * <dt><code>true</code></dt> * <dd>[<em>optional</em>] <a href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>Fully * normalized</a> the characters in the document as defined in appendix B of [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. </dd> * <dt> * <code>false</code></dt> * <dd>[<em>required</em>] (<em>default</em>)Do not perform character normalization.</dd> * </dl></dd> * <dt><code>"schema-location"</code></dt> * <dd>[<em>optional</em>] Represent a <code>DOMString</code> object containing a list of URIs,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -