📄 document.java
字号:
* <dd> * <code>Notation</code> nodes can be imported, however in the current * release of the DOM the <code>DocumentType</code> is readonly. Ability * to add these imported nodes to a <code>DocumentType</code> will be * considered for addition to a future release of the DOM.On import, the * <code>publicId</code> and <code>systemId</code> attributes are copied. * Note that the <code>deep</code> parameter has no effect on this type * of nodes since they cannot have any children.</dd> * <dt> * PROCESSING_INSTRUCTION_NODE</dt> * <dd>The imported node copies its * <code>target</code> and <code>data</code> values from those of the * source node.Note that the <code>deep</code> parameter has no effect * on this type of nodes since they cannot have any children.</dd> * <dt>TEXT_NODE, * CDATA_SECTION_NODE, COMMENT_NODE</dt> * <dd>These three types of nodes inheriting * from <code>CharacterData</code> copy their <code>data</code> and * <code>length</code> attributes from those of the source node.Note * that the <code>deep</code> parameter has no effect on these types of * nodes since they cannot have any children.</dd> * </dl> * @param importedNode The node to import. * @param deep If <code>true</code>, recursively import the subtree under * the specified node; if <code>false</code>, import only the node * itself, as explained above. This has no effect on nodes that cannot * have any children, and on <code>Attr</code>, and * <code>EntityReference</code> nodes. * @return The imported node that belongs to this <code>Document</code>. * @exception DOMException * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not * supported. * <br>INVALID_CHARACTER_ERR: Raised if one of the imported names is not * an XML name according to the XML version in use specified in the * <code>Document.xmlVersion</code> attribute. This may happen when * importing an XML 1.1 [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] element * into an XML 1.0 document, for instance. * @since DOM Level 2 */ public Node importNode(Node importedNode, boolean deep) throws DOMException; /** * Creates an element of the given qualified name and namespace URI. * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] * , applications must use the value <code>null</code> as the * namespaceURI parameter for methods if they wish to have no namespace. * @param namespaceURI The namespace URI of the element to create. * @param qualifiedName The qualified name of the element type to * instantiate. * @return A new <code>Element</code> object with the following * attributes: * <table border='1' cellpadding='3'> * <tr> * <th>Attribute</th> * <th>Value</th> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td> * <td valign='top' rowspan='1' colspan='1'> * <code>qualifiedName</code></td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td> * <td valign='top' rowspan='1' colspan='1'> * <code>namespaceURI</code></td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td> * <td valign='top' rowspan='1' colspan='1'>prefix, extracted * from <code>qualifiedName</code>, or <code>null</code> if there is * no prefix</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td> * <td valign='top' rowspan='1' colspan='1'>local name, extracted from * <code>qualifiedName</code></td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td> * <td valign='top' rowspan='1' colspan='1'> * <code>qualifiedName</code></td> * </tr> * </table> * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified * <code>qualifiedName</code> is not an XML name according to the XML * version in use specified in the <code>Document.xmlVersion</code> * attribute. * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a * malformed qualified name, if the <code>qualifiedName</code> has a * prefix and the <code>namespaceURI</code> is <code>null</code>, or * if the <code>qualifiedName</code> has a prefix that is "xml" and * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'> * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] * , or if the <code>qualifiedName</code> or its prefix is "xmlns" and * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is "xmlns". * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not * support the <code>"XML"</code> feature, since namespaces were * defined by XML. * @since DOM Level 2 */ public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException; /** * Creates an attribute of the given qualified name and namespace URI. * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] * , applications must use the value <code>null</code> as the * <code>namespaceURI</code> parameter for methods if they wish to have * no namespace. * @param namespaceURI The namespace URI of the attribute to create. * @param qualifiedName The qualified name of the attribute to * instantiate. * @return A new <code>Attr</code> object with the following attributes: * <table border='1' cellpadding='3'> * <tr> * <th> * Attribute</th> * <th>Value</th> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td> * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'> * <code>Node.namespaceURI</code></td> * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'> * <code>Node.prefix</code></td> * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from * <code>qualifiedName</code>, or <code>null</code> if there is no * prefix</td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td> * <td valign='top' rowspan='1' colspan='1'>local name, extracted from * <code>qualifiedName</code></td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td> * <td valign='top' rowspan='1' colspan='1'> * <code>qualifiedName</code></td> * </tr> * <tr> * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td> * <td valign='top' rowspan='1' colspan='1'>the empty * string</td> * </tr> * </table> * @exception DOMException * INVALID_CHARACTER_ERR: Raised if the specified * <code>qualifiedName</code> is not an XML name according to the XML * version in use specified in the <code>Document.xmlVersion</code> * attribute. * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a * malformed qualified name, if the <code>qualifiedName</code> has a * prefix and the <code>namespaceURI</code> is <code>null</code>, if * the <code>qualifiedName</code> has a prefix that is "xml" and the * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'> * http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is "xmlns". * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not * support the <code>"XML"</code> feature, since namespaces were * defined by XML. * @since DOM Level 2 */ public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException; /** * Returns a <code>NodeList</code> of all the <code>Elements</code> with a * given local name and namespace URI in document order. * @param namespaceURI The namespace URI of the elements to match on. The * special value <code>"*"</code> matches all namespaces. * @param localName The local name of the elements to match on. The * special value "*" matches all local names. * @return A new <code>NodeList</code> object containing all the matched * <code>Elements</code>. * @since DOM Level 2 */ public NodeList getElementsByTagNameNS(String namespaceURI, String localName); /** * Returns the <code>Element</code> that has an ID attribute with the * given value. If no such element exists, this returns <code>null</code> * . If more than one element has an ID attribute with that value, what * is returned is undefined. * <br> The DOM implementation is expected to use the attribute * <code>Attr.isId</code> to determine if an attribute is of type ID. * <p ><b>Note:</b> Attributes with the name "ID" or "id" are not of type * ID unless so defined. * @param elementId The unique <code>id</code> value for an element. * @return The matching element or <code>null</code> if there is none. * @since DOM Level 2 */ public Element getElementById(String elementId); /** * An attribute specifying the encoding used for this document at the time * of the parsing. This is <code>null</code> when it is not known, such * as when the <code>Document</code> was created in memory. * @since DOM Level 3 */ public String getInputEncoding(); /** * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the encoding of this document. This is <code>null</code> when * unspecified or when it is not known, such as when the * <code>Document</code> was created in memory. * @since DOM Level 3 */ public String getXmlEncoding(); /** * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, whether this document is standalone. This is <code>false</code> when * unspecified. * <p ><b>Note:</b> No verification is done on the value when setting * this attribute. Applications should use * <code>Document.normalizeDocument()</code> with the "validate" * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. * @since DOM Level 3 */ public boolean getXmlStandalone(); /** * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, whether this document is standalone. This is <code>false</code> when * unspecified. * <p ><b>Note:</b> No verification is done on the value when setting * this attribute. Applications should use * <code>Document.normalizeDocument()</code> with the "validate" * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. * @exception DOMException * NOT_SUPPORTED_ERR: Raised if this document does not support the * "XML" feature. * @since DOM Level 3 */ public void setXmlStandalone(boolean xmlStandalone) throws DOMException; /** * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the version number of this document. If there is no declaration and if * this document supports the "XML" feature, the value is * <code>"1.0"</code>. If this document does not support the "XML" * feature, the value is always <code>null</code>. Changing this * attribute will affect methods that check for invalid characters in * XML names. Application should invoke * <code>Document.normalizeDocument()</code> in order to check for * invalid characters in the <code>Node</code>s that are already part of * this <code>Document</code>. * <br> DOM applications may use the * <code>DOMImplementation.hasFeature(feature, version)</code> method * with parameter values "XMLVersion" and "1.0" (respectively) to * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM * applications may use the same method with parameter values * "XMLVersion" and "1.1" (respectively) to determine if an * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both * cases, in order to support XML, an implementation must also support * the "XML" feature defined in this specification. <code>Document</code> * objects supporting a version of the "XMLVersion" feature must not * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version * number when using <code>Document.xmlVersion</code>. * @since DOM Level 3 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -