提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
前言
org.w3c.dom.Node 接口的方法文档
一、Node 接口 说明
Node接口,是文档对象模型(DOM)中的主要数据类型。它表示文档树中的单个节点。尽管所有实现了Node接口的对象都提供了处理子节点的功能,但并非所有对象都具有子节点。对于某些没有明显映射的属性(例如,Element和Comment的属性),这个返回null。
在某些情况下,nodeName、nodeValue和attributes的值取决于节点的类型,如下所示:
Interface | nodeName | nodeValue | attributes |
---|---|---|---|
Attr | 与Attr接口的名称相同 | 与Attr接口的值相同 | null |
CDATASection | “#cdata-section” 与CharacterData接口的数据相同, | CDATA段落的内容 | null |
Comment | “#comment” 与CharacterData接口的数据相同, | 注释的内容 | null |
Document | “#document” | null | null |
DocumentFragment | “#document-fragment” | null | null |
DocumentType | 与DocumentType接口的名称相同 | null | null |
Element | 与Element接口的标签名称相同 | null | NamedNodeMap |
Entity | 实体名称 | null | null |
EntityReference | 实体引用的名称 | null | null |
Notation | notation名称 | null | null |
ProcessingInstruction | 与ProcessingInstruction接口的目标名称相同 | 与ProcessingInstruction接口的数据相同 | null |
Text | “#text” 与CharacterData接口的数据相同, | 文本节点的内容 | null |
注意,在DOM级别3核心规范中,也有关于Node接口的定义。
二、类成员
1.类变量(常量)+注释
代码如下:
// The node is an Element 该节点为元素节点
public static final short ELEMENT_NODE = 1;
//The node is an Attr 该节点为属性节点
public static final short ATTRIBUTE_NODE = 2;
//The node is a Text node 该节点为文本节点
public static final short TEXT_NODE = 3;
//The node is a CDATASection 该节点为CDATASection节点
public static final short CDATA_SECTION_NODE = 4;
//The node is an EntityReference 该节点为实体引用节点
public static final short ENTITY_REFERENCE_NODE = 5;
//The node is an Entity 该节点为实体节点
public static final short ENTITY_NODE = 6;
//The node is a ProcessingInstruction 该节点为处理指令节点
public static final short PROCESSING_INSTRUCTION_NODE = 7;
//The node is a Comment 该节点为注释节点
public static final short COMMENT_NODE = 8;
//The node is a Document 该节点为文档节点
public static final short DOCUMENT_NODE = 9;
//The node is a DocumentType 该节点为文档类型节点
public static final short DOCUMENT_TYPE_NODE = 10;
//The node is a DocumentFragment 该节点为文档碎片节点
public static final short DOCUMENT_FRAGMENT_NODE = 11;
//The node is a Notation 该节点为符号节点
public static final short NOTATION_NODE = 12;
2.方法+注释
代码如下:
/**
* 节点的名称,取决于它的类型;见上表。
*/
public String getNodeName();
/**
* get该节点的值,取决于它的类型;见上表。
* 当定义为null时,设置该值无效;
* 包括只读节点。
* @exception DOMException
* DOMSTRING_SIZE_ERR:当它返回的字符多于实现平台上DOMString变量所适合的字符时引发。
*/
public String getNodeValue() throws DOMException;
/**
* set该节点的值,取决于它的类型;见上表。
* 当它被定义为null时,设置它没有效果,包括如果节点是只读的。
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR:当节点为只读且未定义为null时将被引发
*/
public void setNodeValue(String nodeValue) throws DOMException;
/**
* 表示基础对象类型的代码,如上所定义。
*/
public short getNodeType();
/**
* 获取该节点的父节点。除了Attr、Document、DocumentFragment、Entity和Notation之外,
* 所有节点都可以有父节点。
* 但是,如果一个节点刚刚创建,还没有添加到树中,或者它已经从树中删除,则该值为空
*/
public Node getParentNode();
/**
* 包含该节点所有子节点的NodeList。如果没有子节点,则这是一个不包含节点的NodeList。
*/
public NodeList getChildNodes();
/**
* 此节点的第一个子节点。如果没有这样的节点,则返回null。
*/
public Node getFirstChild();
/**
* 此节点的最后一个子节点。如果没有这样的节点,则返回
* null
*/
public Node getLastChild();
/**
* 紧接在该节点前面的节点。如果没有这样的节点,则返回null。
*/
public Node getPreviousSibling();
/**
* 紧跟在这个节点后面的节点。如果没有这样的节点,则返回null。
*/
public Node getNextSibling();
/**
* NamedNodeMap包含该节点的属性(如果它是一个元素),否则为空。
*/
public NamedNodeMap getAttributes();
/**
* 与此节点关联的Document对象。这也是用于创建新节点的Document对象。
* 当此节点是Document或尚未与任何Document一起使用的DocumentType时,该节点为空。
* @since DOM Level 2
*/
public Document getOwnerDocument();
/**
* 在现有子节点refChild之前插入节点newChild。如果refchild为空,则在子列表的末尾插入newChild。
*
* 如果newChild是一个DocumentFragment对象,则在refchild之前以相同的顺序插入它的所有子对象。
* 如果newChild已经在树中,它首先被删除。注意:在自身之前插入节点依赖于实现。
* 形参: newChild—要插入的节点。
* refChild -参考节点,即必须插入新节点之前的节点。
* 返回值: The node being inserted.
* 抛出:DOMException
* - HIERARCHY_REQUEST_ERR:如果此节点的类型不允许newChild节点的子节点类型,
* 或者要插入的节点是该节点的祖先节点之一或该节点本身,
* 或者该节点是Document类型并且DoM应用程序试图插入第二个DocumentType或Element节点,
* 则引发此异常。
* - WRONG_DOCUMENT_ERR:如果newChild是从不同的文档中创建的,将被引发。
* - NO_MODIFICATION_ALLOWED_ERR:如果该节点是只读的,或者插入的节点的父节点是只读的,
* 则会被引发。
* - NOT_FOUND_ERR:如果refChild不是此节点的子节点则引发。
* - NOT_SUPPORTED_ERR:如果该节点为Document类型,
* 则如果DOM实现不支持插入DocumentType或Element节点,则可能引发此异常。
*
* @since DOM Level 3
*/
public Node insertBefore(Node newChild,
Node refChild)
throws DOMException;
/**
* 将子节点oldchild替换为子节点列表中的newChild,并返回oldchild节点。
* 如果newChild是一个DocumentFragment对象,那么oldChild将被所有的DocumentFragment子对象替换,
* 这些子对象以相同的顺序插入。
* 如果newChild已经在树中,它首先被删除。
* 注意:用自身替换节点依赖于实现。
* 形参: newChild—要放入子列表中的新节点。
* oldChild -列表中被替换的节点。
* 返回值: The node replaced.
* 抛出:DOMException
* - HIERARCHY_REQUEST_ERR:如果此节点的类型不允许newChild节点的子节点类型,
* 或者要放入的节点是该节点的祖先节点之一或该节点本身,
* 或者该节点的类型为Document,并且替换操作的结果将添加第二个DocumentType或Element,
* 则引发此异常Document节点。
* - WRONG_DOCUMENT_ERR:如果newChild是从不同的文档中创建的,将被引发。
* - NO_MODIFICATION_ALLOWED_ERR:如果此节点或父节点新节点为只读节点。
* - NOT_FOUND_ERR:如果oldChild不是此节点的子节点将引发。
* - NOT_SUPPORTED_ERR:如果该节点为Document类型,
* 则如果DoM实现不支持替换DocumentType子节点或Element子节点,则可能引发此异常
*
* @since DOM Level 3
*/
public Node replaceChild(Node newChild,
Node oldChild)
throws DOMException;
/**
* 从子节点列表中删除oldChild所指示的子节点,并返回它。
* 形参:oldchild—被移除的节点。
* 返回值: The node removed.
* 抛出:DOMException
* - NO_MODIFICATION_ALLOWED_ERR:如果该节点是只读的。
* - NOT_FOUND_ERR:如果oldchild不是此节点的子节点将引发。
* - NOT_SUPPORTED_ERR:如果该节点为Document类型,
* - 则如果DOM实现不支持移除DocumentType子节点或Element子节点,则可能引发此异常。
*/
public Node removeChild(Node oldChild)
throws DOMException;
/**
* 将节点newChild添加到此节点的子节点列表的末尾。
* 如果newChild已经在树中,它首先被删除。
* 形参: newChild—要添加的节点。
* 如果它是一个DocumentFragment对象,则文档片段的整个内容将被移动到该节点的子列表中
* 返回值: The node added.
* 抛出:DOMException
* - HIERARCHY_REQUEST_ERR:如果此节点的类型不允许newChild节点的子节点类型,
* 或者要追加的节点是该节点的祖先节点之一或该节点本身,
* 或者该节点是Document类型并且DOM应用程序试图追加第二个DocumentType或Element节点,
* 则会引发此异常。
* - WRONG_DOCUMENT_ERR:如果newChild是从不同的文档中创建的,将被引发。
* - NO_MODIFICATION_ALLOWED_ERR:如果这个节点是只读的,或者被插入节点的上一个父节点是只读的,
* 将被引发。
* - NOT_SUPPORTED_ERR:如果newChild节点是Document节点的子节点,
* 如果DOM实现不支持移除DocumentType子节点或Element子节点,则可能引发此异常。
*
* @since DOM Level 3
*/
public Node appendChild(Node newChild)
throws DOMException;
/**
* 返回该节点是否有任何子节点。
* 如果此节点有任何子节点则返回true,否则返回false。
*/
public boolean hasChildNodes();
/**
* 返回该节点的副本,即作为节点的通用复制构造函数。
* 重复节点没有父节点(parentNode为null),也没有用户数据。与导入节点关联的用户数据不会结转。
* 但是,如果指定了任何UserDataHandlers以及相关的数据,
* 这些处理程序将在此方法返回之前使用适当的参数调用。克隆元素复制所有属性及其值,包括XML处理程序
* 生成的表示默认属性的属性,但是此方法不复制它包含的任何子元素,除非它是深度克隆。
* 这包括元素中包含的文本,因为文本包含在子text节点中。
* 直接克隆Attr(而不是作为Element克隆操作的一部分克隆)将返回指定的属性(指定为真)。
* 克隆一个Attr总是会克隆它的子元素,因为它们代表了它的价值,无论这是否是深度克隆。
* 如果对应的Entity可用,克隆EntityReference会自动构建它的子树,无论这是否是深度克隆。
* 克隆任何其他类型的节点只是返回该节点的副本。
* 注意,克隆一个不可变子树会产生一个可变的副本,但是EntityReference克隆的子树是只读的。
* 此外,还指定了未指定的Attr节点的克隆。
* 而且,克隆Document、DocumentType、Entity和Notation节点依赖于实现。
* 形参: deep 如果为true,则在指定节点下递归克隆子树;
* 如果为false,则只克隆节点本身(如果是Element,则克隆其属性)。
* 返回值:The duplicate node.
*/
public Node cloneNode(boolean deep);
/**
* Puts all <code>Text</code> nodes in the full depth of the sub-tree
* underneath this <code>Node</code>, including attribute nodes, into a
* "normal" form where only structure (e.g., elements, comments,
* processing instructions, CDATA sections, and entity references)
* separates <code>Text</code> nodes, i.e., there are neither adjacent
* <code>Text</code> nodes nor empty <code>Text</code> nodes. This can
* be used to ensure that the DOM view of a document is the same as if
* it were saved and re-loaded, and is useful when operations (such as
* XPointer [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>]
* lookups) that depend on a particular document tree structure are to
* be used. If the parameter "normalize-characters" of the
* <code>DOMConfiguration</code> object attached to the
* <code>Node.ownerDocument</code> is <code>true</code>, this method
* will also fully normalize the characters of the <code>Text</code>
* nodes.
* <p ><b>Note:</b> In cases where the document contains
* <code>CDATASections</code>, the normalize operation alone may not be
* sufficient, since XPointers do not differentiate between
* <code>Text</code> nodes and <code>CDATASection</code> nodes.
*
* @since DOM Level 3
*/
public void normalize();
/**
* Tests whether the DOM implementation implements a specific feature and
* that feature is supported by this node, as specified in .
* @param feature The name of the feature to test.
* @param version This is the version number of the feature to test.
* @return Returns <code>true</code> if the specified feature is
* supported on this node, <code>false</code> otherwise.
*
* @since DOM Level 2
*/
public boolean isSupported(String feature,
String version);
/**
* The namespace URI of this node, or <code>null</code> if it is
* unspecified (see ).
* <br>This is not a computed value that is the result of a namespace
* lookup based on an examination of the namespace declarations in
* scope. It is merely the namespace URI given at creation time.
* <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
* <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
* method, such as <code>Document.createElement()</code>, this is always
* <code>null</code>.
* <p ><b>Note:</b> Per the <em>Namespaces in XML</em> Specification [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
* an attribute does not inherit its namespace from the element it is
* attached to. If an attribute is not explicitly given a namespace, it
* simply has no namespace.
*
* @since DOM Level 2
*/
public String getNamespaceURI();
/**
* The namespace prefix of this node, or <code>null</code> if it is
* unspecified. When it is defined to be <code>null</code>, setting it
* has no effect, including if the node is read-only.
* <br>Note that setting this attribute, when permitted, changes the
* <code>nodeName</code> attribute, which holds the qualified name, as
* well as the <code>tagName</code> and <code>name</code> attributes of
* the <code>Element</code> and <code>Attr</code> interfaces, when
* applicable.
* <br>Setting the prefix to <code>null</code> makes it unspecified,
* setting it to an empty string is implementation dependent.
* <br>Note also that changing the prefix of an attribute that is known to
* have a default value, does not make a new attribute with the default
* value and the original prefix appear, since the
* <code>namespaceURI</code> and <code>localName</code> do not change.
* <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
* <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
* method, such as <code>createElement</code> from the
* <code>Document</code> interface, this is always <code>null</code>.
*
* @since DOM Level 2
*/
public String getPrefix();
/**
* The namespace prefix of this node, or <code>null</code> if it is
* unspecified. When it is defined to be <code>null</code>, setting it
* has no effect, including if the node is read-only.
* <br>Note that setting this attribute, when permitted, changes the
* <code>nodeName</code> attribute, which holds the qualified name, as
* well as the <code>tagName</code> and <code>name</code> attributes of
* the <code>Element</code> and <code>Attr</code> interfaces, when
* applicable.
* <br>Setting the prefix to <code>null</code> makes it unspecified,
* setting it to an empty string is implementation dependent.
* <br>Note also that changing the prefix of an attribute that is known to
* have a default value, does not make a new attribute with the default
* value and the original prefix appear, since the
* <code>namespaceURI</code> and <code>localName</code> do not change.
* <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
* <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
* method, such as <code>createElement</code> from the
* <code>Document</code> interface, this is always <code>null</code>.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
* illegal character according to the XML version in use specified in
* the <code>Document.xmlVersion</code> attribute.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is
* malformed per the Namespaces in XML specification, if the
* <code>namespaceURI</code> of this node is <code>null</code>, if the
* specified prefix is "xml" and the <code>namespaceURI</code> of this
* node is different from "<a href='http://www.w3.org/XML/1998/namespace'>
* http://www.w3.org/XML/1998/namespace</a>", if this node is an attribute and the specified prefix is "xmlns" and
* the <code>namespaceURI</code> of this node is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if this node is an attribute and the <code>qualifiedName</code> of
* this node is "xmlns" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
* .
*
* @since DOM Level 2
*/
public void setPrefix(String prefix)
throws DOMException;
/**
* Returns the local part of the qualified name of this node.
* <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
* <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
* method, such as <code>Document.createElement()</code>, this is always
* <code>null</code>.
*
* @since DOM Level 2
*/
public String getLocalName();
/**
* Returns whether this node (if it is an element) has any attributes.
* @return Returns <code>true</code> if this node has any attributes,
* <code>false</code> otherwise.
*
* @since DOM Level 2
*/
public boolean hasAttributes();
/**
* The absolute base URI of this node or <code>null</code> if the
* implementation wasn't able to obtain an absolute URI. This value is
* computed as described in . However, when the <code>Document</code>
* supports the feature "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
* , the base URI is computed using first the value of the href
* attribute of the HTML BASE element if any, and the value of the
* <code>documentURI</code> attribute from the <code>Document</code>
* interface otherwise.
*
* @since DOM Level 3
*/
public String getBaseURI();
// DocumentPosition
/**
* The two nodes are disconnected. Order between disconnected nodes is
* always implementation-specific.
*/
public static final short DOCUMENT_POSITION_DISCONNECTED = 0x01;
/**
* The second node precedes the reference node.
*/
public static final short DOCUMENT_POSITION_PRECEDING = 0x02;
/**
* The node follows the reference node.
*/
public static final short DOCUMENT_POSITION_FOLLOWING = 0x04;
/**
* The node contains the reference node. A node which contains is always
* preceding, too.
*/
public static final short DOCUMENT_POSITION_CONTAINS = 0x08;
/**
* The node is contained by the reference node. A node which is contained
* is always following, too.
*/
public static final short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
/**
* The determination of preceding versus following is
* implementation-specific.
*/
public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
/**
* Compares the reference node, i.e. the node on which this method is
* being called, with a node, i.e. the one passed as a parameter, with
* regard to their position in the document and according to the
* document order.
* @param other The node to compare against the reference node.
* @return Returns how the node is positioned relatively to the reference
* node.
* @exception DOMException
* NOT_SUPPORTED_ERR: when the compared nodes are from different DOM
* implementations that do not coordinate to return consistent
* implementation-specific results.
*
* @since DOM Level 3
*/
public short compareDocumentPosition(Node other)
throws DOMException;
/**
* This attribute returns the text content of this node and its
* descendants. When it is defined to be <code>null</code>, setting it
* has no effect. On setting, any possible children this node may have
* are removed and, if it the new string is not empty or
* <code>null</code>, replaced by a single <code>Text</code> node
* containing the string this attribute is set to.
* <br> On getting, no serialization is performed, the returned string
* does not contain any markup. No whitespace normalization is performed
* and the returned string does not contain the white spaces in element
* content (see the attribute
* <code>Text.isElementContentWhitespace</code>). Similarly, on setting,
* no parsing is performed either, the input string is taken as pure
* textual content.
* <br>The string returned is made of the text content of this node
* depending on its type, as defined below:
* <table border='1' cellpadding='3'>
* <tr>
* <th>Node type</th>
* <th>Content</th>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE</td>
* <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE</td>
* <td valign='top' rowspan='1' colspan='1'><code>nodeValue</code></td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
* <td valign='top' rowspan='1' colspan='1'><em>null</em></td>
* </tr>
* </table>
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
* fit in a <code>DOMString</code> variable on the implementation
* platform.
*
* @since DOM Level 3
*/
public String getTextContent()
throws DOMException;
/**
* This attribute returns the text content of this node and its
* descendants. When it is defined to be <code>null</code>, setting it
* has no effect. On setting, any possible children this node may have
* are removed and, if it the new string is not empty or
* <code>null</code>, replaced by a single <code>Text</code> node
* containing the string this attribute is set to.
* <br> On getting, no serialization is performed, the returned string
* does not contain any markup. No whitespace normalization is performed
* and the returned string does not contain the white spaces in element
* content (see the attribute
* <code>Text.isElementContentWhitespace</code>). Similarly, on setting,
* no parsing is performed either, the input string is taken as pure
* textual content.
* <br>The string returned is made of the text content of this node
* depending on its type, as defined below:
* <table border='1' cellpadding='3'>
* <tr>
* <th>Node type</th>
* <th>Content</th>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>
* ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
* DOCUMENT_FRAGMENT_NODE</td>
* <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code>
* attribute value of every child node, excluding COMMENT_NODE and
* PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the
* node has no children.</td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
* PROCESSING_INSTRUCTION_NODE</td>
* <td valign='top' rowspan='1' colspan='1'><code>nodeValue</code></td>
* </tr>
* <tr>
* <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE,
* DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
* <td valign='top' rowspan='1' colspan='1'><em>null</em></td>
* </tr>
* </table>
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
*
* @since DOM Level 3
*/
public void setTextContent(String textContent)
throws DOMException;
/**
* Returns whether this node is the same node as the given one.
* <br>This method provides a way to determine whether two
* <code>Node</code> references returned by the implementation reference
* the same object. When two <code>Node</code> references are references
* to the same object, even if through a proxy, the references may be
* used completely interchangeably, such that all attributes have the
* same values and calling the same DOM method on either reference
* always has exactly the same effect.
* @param other The node to test against.
* @return Returns <code>true</code> if the nodes are the same,
* <code>false</code> otherwise.
*
* @since DOM Level 3
*/
public boolean isSameNode(Node other);
/**
* Look up the prefix associated to the given namespace URI, starting from
* this node. The default namespace declarations are ignored by this
* method.
* <br>See for details on the algorithm used by this method.
* @param namespaceURI The namespace URI to look for.
* @return Returns an associated namespace prefix if found or
* <code>null</code> if none is found. If more than one prefix are
* associated to the namespace prefix, the returned namespace prefix
* is implementation dependent.
*
* @since DOM Level 3
*/
public String lookupPrefix(String namespaceURI);
/**
* This method checks if the specified <code>namespaceURI</code> is the
* default namespace or not.
* @param namespaceURI The namespace URI to look for.
* @return Returns <code>true</code> if the specified
* <code>namespaceURI</code> is the default namespace,
* <code>false</code> otherwise.
*
* @since DOM Level 3
*/
public boolean isDefaultNamespace(String namespaceURI);
/**
* Look up the namespace URI associated to the given prefix, starting from
* this node.
* <br>See for details on the algorithm used by this method.
* @param prefix The prefix to look for. If this parameter is
* <code>null</code>, the method will return the default namespace URI
* if any.
* @return Returns the associated namespace URI or <code>null</code> if
* none is found.
*
* @since DOM Level 3
*/
public String lookupNamespaceURI(String prefix);
/**
* Tests whether two nodes are equal.
* <br>This method tests for equality of nodes, not sameness (i.e.,
* whether the two nodes are references to the same object) which can be
* tested with <code>Node.isSameNode()</code>. All nodes that are the
* same will also be equal, though the reverse may not be true.
* <br>Two nodes are equal if and only if the following conditions are
* satisfied:
* <ul>
* <li>The two nodes are of the same type.
* </li>
* <li>The following string
* attributes are equal: <code>nodeName</code>, <code>localName</code>,
* <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
* . This is: they are both <code>null</code>, or they have the same
* length and are character for character identical.
* </li>
* <li>The
* <code>attributes</code> <code>NamedNodeMaps</code> are equal. This
* is: they are both <code>null</code>, or they have the same length and
* for each node that exists in one map there is a node that exists in
* the other map and is equal, although not necessarily at the same
* index.
* </li>
* <li>The <code>childNodes</code> <code>NodeLists</code> are equal.
* This is: they are both <code>null</code>, or they have the same
* length and contain equal nodes at the same index. Note that
* normalization can affect equality; to avoid this, nodes should be
* normalized before being compared.
* </li>
* </ul>
* <br>For two <code>DocumentType</code> nodes to be equal, the following
* conditions must also be satisfied:
* <ul>
* <li>The following string attributes
* are equal: <code>publicId</code>, <code>systemId</code>,
* <code>internalSubset</code>.
* </li>
* <li>The <code>entities</code>
* <code>NamedNodeMaps</code> are equal.
* </li>
* <li>The <code>notations</code>
* <code>NamedNodeMaps</code> are equal.
* </li>
* </ul>
* <br>On the other hand, the following do not affect equality: the
* <code>ownerDocument</code>, <code>baseURI</code>, and
* <code>parentNode</code> attributes, the <code>specified</code>
* attribute for <code>Attr</code> nodes, the <code>schemaTypeInfo</code>
* attribute for <code>Attr</code> and <code>Element</code> nodes, the
* <code>Text.isElementContentWhitespace</code> attribute for
* <code>Text</code> nodes, as well as any user data or event listeners
* registered on the nodes.
* <p ><b>Note:</b> As a general rule, anything not mentioned in the
* description above is not significant in consideration of equality
* checking. Note that future versions of this specification may take
* into account more attributes and implementations conform to this
* specification are expected to be updated accordingly.
* @param arg The node to compare equality with.
* @return Returns <code>true</code> if the nodes are equal,
* <code>false</code> otherwise.
*
* @since DOM Level 3
*/
public boolean isEqualNode(Node arg);
/**
* This method returns a specialized object which implements the
* specialized APIs of the specified feature and version, as specified
* in . The specialized object may also be obtained by using
* binding-specific casting methods but is not necessarily expected to,
* as discussed in . This method also allow the implementation to
* provide specialized objects which do not support the <code>Node</code>
* interface.
* @param feature The name of the feature requested. Note that any plus
* sign "+" prepended to the name of the feature will be ignored since
* it is not significant in the context of this method.
* @param version This is the version number of the feature to test.
* @return Returns an object which implements the specialized APIs of
* the specified feature and version, if any, or <code>null</code> if
* there is no object which implements interfaces associated with that
* feature. If the <code>DOMObject</code> returned by this method
* implements the <code>Node</code> interface, it must delegate to the
* primary core <code>Node</code> and not return results inconsistent
* with the primary core <code>Node</code> such as attributes,
* childNodes, etc.
*
* @since DOM Level 3
*/
public Object getFeature(String feature,
String version);
/**
* Associate an object to a key on this node. The object can later be
* retrieved from this node by calling <code>getUserData</code> with the
* same key.
* @param key The key to associate the object to.
* @param data The object to associate to the given key, or
* <code>null</code> to remove any existing association to that key.
* @param handler The handler to associate to that key, or
* <code>null</code>.
* @return Returns the <code>DOMUserData</code> previously associated to
* the given key on this node, or <code>null</code> if there was none.
*
* @since DOM Level 3
*/
public Object setUserData(String key,
Object data,
UserDataHandler handler);
/**
* Retrieves the object associated to a key on a this node. The object
* must first have been set to this node by calling
* <code>setUserData</code> with the same key.
* @param key The key the object is associated to.
* @return Returns the <code>DOMUserData</code> associated to the given
* key on this node, or <code>null</code> if there was none.
*
* @since DOM Level 3
*/
public Object getUserData(String key);