+++ /dev/null
-/*\r
- * Copyright (c) 2000 World Wide Web Consortium,\r
- * (Massachusetts Institute of Technology, Institut National de\r
- * Recherche en Informatique et en Automatique, Keio University). All\r
- * Rights Reserved. This program is distributed under the W3C's Software\r
- * Intellectual Property License. This program is distributed in the\r
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- * PURPOSE.\r
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
- */\r
-\r
-package org.w3c.dom;\r
-\r
-/**\r
- * The <code>Element</code> interface represents an element in an HTML or XML \r
- * document. Elements may have attributes associated with them; since the \r
- * <code>Element</code> interface inherits from <code>Node</code>, the \r
- * generic <code>Node</code> interface attribute <code>attributes</code> may \r
- * be used to retrieve the set of all attributes for an element. There are \r
- * methods on the <code>Element</code> interface to retrieve either an \r
- * <code>Attr</code> object by name or an attribute value by name. In XML, \r
- * where an attribute value may contain entity references, an \r
- * <code>Attr</code> object should be retrieved to examine the possibly \r
- * fairly complex sub-tree representing the attribute value. On the other \r
- * hand, in HTML, where all attributes have simple string values, methods to \r
- * directly access an attribute value can safely be used as a convenience.In \r
- * DOM Level 2, the method <code>normalize</code> is inherited from the \r
- * <code>Node</code> interface where it was moved.\r
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.\r
- */\r
-public interface Element extends Node {\r
- /**\r
- * The name of the element. For example, in: \r
- * <pre> <elementExample \r
- * id="demo"> ... </elementExample> , </pre>\r
- * <code>tagName</code> has \r
- * the value <code>"elementExample"</code>. Note that this is \r
- * case-preserving in XML, as are all of the operations of the DOM. The \r
- * HTML DOM returns the <code>tagName</code> of an HTML element in the \r
- * canonical uppercase form, regardless of the case in the source HTML \r
- * document. \r
- */\r
- public String getTagName();\r
-\r
- /**\r
- * Retrieves an attribute value by name.\r
- * @param nameThe name of the attribute to retrieve.\r
- * @return The <code>Attr</code> value as a string, or the empty string \r
- * if that attribute does not have a specified or default value.\r
- */\r
- public String getAttribute(String name);\r
-\r
- /**\r
- * Adds a new attribute. If an attribute with that name is already present \r
- * in the element, its value is changed to be that of the value \r
- * parameter. This value is a simple string; it is not parsed as it is \r
- * being set. So any markup (such as syntax to be recognized as an \r
- * entity reference) is treated as literal text, and needs to be \r
- * appropriately escaped by the implementation when it is written out. \r
- * In order to assign an attribute value that contains entity \r
- * references, the user must create an <code>Attr</code> node plus any \r
- * <code>Text</code> and <code>EntityReference</code> nodes, build the \r
- * appropriate subtree, and use <code>setAttributeNode</code> to assign \r
- * it as the value of an attribute.\r
- * <br>To set an attribute with a qualified name and namespace URI, use \r
- * the <code>setAttributeNS</code> method.\r
- * @param nameThe name of the attribute to create or alter.\r
- * @param valueValue to set in string form.\r
- * @exception DOMException\r
- * INVALID_CHARACTER_ERR: Raised if the specified name contains an \r
- * illegal character.\r
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
- */\r
- public void setAttribute(String name, \r
- String value)\r
- throws DOMException;\r
-\r
- /**\r
- * Removes an attribute by name. If the removed attribute is known to have \r
- * a default value, an attribute immediately appears containing the \r
- * default value as well as the corresponding namespace URI, local name, \r
- * and prefix when applicable.\r
- * <br>To remove an attribute by local name and namespace URI, use the \r
- * <code>removeAttributeNS</code> method.\r
- * @param nameThe name of the attribute to remove.\r
- * @exception DOMException\r
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
- */\r
- public void removeAttribute(String name)\r
- throws DOMException;\r
-\r
- /**\r
- * Retrieves an attribute node by name.\r
- * <br>To retrieve an attribute node by qualified name and namespace URI, \r
- * use the <code>getAttributeNodeNS</code> method.\r
- * @param nameThe name (<code>nodeName</code>) of the attribute to \r
- * retrieve.\r
- * @return The <code>Attr</code> node with the specified name (\r
- * <code>nodeName</code>) or <code>null</code> if there is no such \r
- * attribute.\r
- */\r
- public Attr getAttributeNode(String name);\r
-\r
- /**\r
- * Adds a new attribute node. If an attribute with that name (\r
- * <code>nodeName</code>) is already present in the element, it is \r
- * replaced by the new one.\r
- * <br>To add a new attribute node with a qualified name and namespace \r
- * URI, use the <code>setAttributeNodeNS</code> method.\r
- * @param newAttrThe <code>Attr</code> node to add to the attribute list.\r
- * @return If the <code>newAttr</code> attribute replaces an existing \r
- * attribute, the replaced <code>Attr</code> node is returned, \r
- * otherwise <code>null</code> is returned.\r
- * @exception DOMException\r
- * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a \r
- * different document than the one that created the element.\r
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
- * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an \r
- * attribute of another <code>Element</code> object. The DOM user must \r
- * explicitly clone <code>Attr</code> nodes to re-use them in other \r
- * elements.\r
- */\r
- public Attr setAttributeNode(Attr newAttr)\r
- throws DOMException;\r
-\r
- /**\r
- * Removes the specified attribute node. If the removed <code>Attr</code> \r
- * has a default value it is immediately replaced. The replacing \r
- * attribute has the same namespace URI and local name, as well as the \r
- * original prefix, when applicable.\r
- * @param oldAttrThe <code>Attr</code> node to remove from the attribute \r
- * list.\r
- * @return The <code>Attr</code> node that was removed.\r
- * @exception DOMException\r
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
- * <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute \r
- * of the element.\r
- */\r
- public Attr removeAttributeNode(Attr oldAttr)\r
- throws DOMException;\r
-\r
- /**\r
- * Returns a <code>NodeList</code> of all descendant <code>Elements</code> \r
- * with a given tag name, in the order in which they are encountered in \r
- * a preorder traversal of this <code>Element</code> tree.\r
- * @param nameThe name of the tag to match on. The special value "*" \r
- * matches all tags.\r
- * @return A list of matching <code>Element</code> nodes.\r
- */\r
- public NodeList getElementsByTagName(String name);\r
-\r
- /**\r
- * Retrieves an attribute value by local name and namespace URI. HTML-only \r
- * DOM implementations do not need to implement this method.\r
- * @param namespaceURIThe namespace URI of the attribute to retrieve.\r
- * @param localNameThe local name of the attribute to retrieve.\r
- * @return The <code>Attr</code> value as a string, or the empty string \r
- * if that attribute does not have a specified or default value.\r
- * @since DOM Level 2\r
- */\r
- public String getAttributeNS(String namespaceURI, \r
- String localName);\r
-\r
- /**\r
- * Adds a new attribute. If an attribute with the same local name and \r
- * namespace URI is already present on the element, its prefix is \r
- * changed to be the prefix part of the <code>qualifiedName</code>, and \r
- * its value is changed to be the <code>value</code> parameter. This \r
- * value is a simple string; it is not parsed as it is being set. So any \r
- * markup (such as syntax to be recognized as an entity reference) is \r
- * treated as literal text, and needs to be appropriately escaped by the \r
- * implementation when it is written out. In order to assign an \r
- * attribute value that contains entity references, the user must create \r
- * an <code>Attr</code> node plus any <code>Text</code> and \r
- * <code>EntityReference</code> nodes, build the appropriate subtree, \r
- * and use <code>setAttributeNodeNS</code> or \r
- * <code>setAttributeNode</code> to assign it as the value of an \r
- * attribute.\r
- * <br>HTML-only DOM implementations do not need to implement this method.\r
- * @param namespaceURIThe namespace URI of the attribute to create or \r
- * alter.\r
- * @param qualifiedNameThe qualified name of the attribute to create or \r
- * alter.\r
- * @param valueThe value to set in string form.\r
- * @exception DOMException\r
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name \r
- * contains an illegal character.\r
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
- * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is \r
- * malformed, if the <code>qualifiedName</code> has a prefix and the \r
- * <code>namespaceURI</code> is <code>null</code>, if the \r
- * <code>qualifiedName</code> has a prefix that is "xml" and the \r
- * <code>namespaceURI</code> is different from "\r
- * http://www.w3.org/XML/1998/namespace", or if the \r
- * <code>qualifiedName</code> is "xmlns" and the \r
- * <code>namespaceURI</code> is different from "\r
- * http://www.w3.org/2000/xmlns/".\r
- * @since DOM Level 2\r
- */\r
- public void setAttributeNS(String namespaceURI, \r
- String qualifiedName, \r
- String value)\r
- throws DOMException;\r
-\r
- /**\r
- * Removes an attribute by local name and namespace URI. If the removed \r
- * attribute has a default value it is immediately replaced. The \r
- * replacing attribute has the same namespace URI and local name, as \r
- * well as the original prefix.\r
- * <br>HTML-only DOM implementations do not need to implement this method.\r
- * @param namespaceURIThe namespace URI of the attribute to remove.\r
- * @param localNameThe local name of the attribute to remove.\r
- * @exception DOMException\r
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
- * @since DOM Level 2\r
- */\r
- public void removeAttributeNS(String namespaceURI, \r
- String localName)\r
- throws DOMException;\r
-\r
- /**\r
- * Retrieves an <code>Attr</code> node by local name and namespace URI. \r
- * HTML-only DOM implementations do not need to implement this method.\r
- * @param namespaceURIThe namespace URI of the attribute to retrieve.\r
- * @param localNameThe local name of the attribute to retrieve.\r
- * @return The <code>Attr</code> node with the specified attribute local \r
- * name and namespace URI or <code>null</code> if there is no such \r
- * attribute.\r
- * @since DOM Level 2\r
- */\r
- public Attr getAttributeNodeNS(String namespaceURI, \r
- String localName);\r
-\r
- /**\r
- * Adds a new attribute. If an attribute with that local name and that \r
- * namespace URI is already present in the element, it is replaced by \r
- * the new one.\r
- * <br>HTML-only DOM implementations do not need to implement this method.\r
- * @param newAttrThe <code>Attr</code> node to add to the attribute list.\r
- * @return If the <code>newAttr</code> attribute replaces an existing \r
- * attribute with the same local name and namespace URI, the replaced \r
- * <code>Attr</code> node is returned, otherwise <code>null</code> is \r
- * returned.\r
- * @exception DOMException\r
- * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a \r
- * different document than the one that created the element.\r
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.\r
- * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an \r
- * attribute of another <code>Element</code> object. The DOM user must \r
- * explicitly clone <code>Attr</code> nodes to re-use them in other \r
- * elements.\r
- * @since DOM Level 2\r
- */\r
- public Attr setAttributeNodeNS(Attr newAttr)\r
- throws DOMException;\r
-\r
- /**\r
- * Returns a <code>NodeList</code> of all the descendant \r
- * <code>Elements</code> with a given local name and namespace URI in \r
- * the order in which they are encountered in a preorder traversal of \r
- * this <code>Element</code> tree.\r
- * <br>HTML-only DOM implementations do not need to implement this method.\r
- * @param namespaceURIThe namespace URI of the elements to match on. The \r
- * special value "*" matches all namespaces.\r
- * @param localNameThe local name of the elements to match on. The \r
- * special value "*" matches all local names.\r
- * @return A new <code>NodeList</code> object containing all the matched \r
- * <code>Elements</code>.\r
- * @since DOM Level 2\r
- */\r
- public NodeList getElementsByTagNameNS(String namespaceURI, \r
- String localName);\r
-\r
- /**\r
- * Returns <code>true</code> when an attribute with a given name is \r
- * specified on this element or has a default value, <code>false</code> \r
- * otherwise.\r
- * @param nameThe name of the attribute to look for.\r
- * @return <code>true</code> if an attribute with the given name is \r
- * specified on this element or has a default value, <code>false</code>\r
- * otherwise.\r
- * @since DOM Level 2\r
- */\r
- public boolean hasAttribute(String name);\r
-\r
- /**\r
- * Returns <code>true</code> when an attribute with a given local name and \r
- * namespace URI is specified on this element or has a default value, \r
- * <code>false</code> otherwise. HTML-only DOM implementations do not \r
- * need to implement this method.\r
- * @param namespaceURIThe namespace URI of the attribute to look for.\r
- * @param localNameThe local name of the attribute to look for.\r
- * @return <code>true</code> if an attribute with the given local name \r
- * and namespace URI is specified or has a default value on this \r
- * element, <code>false</code> otherwise.\r
- * @since DOM Level 2\r
- */\r
- public boolean hasAttributeNS(String namespaceURI, \r
- String localName);\r
-\r
-}\r