org.w3c.dom
Interface Element

All Superinterfaces:
Node sample code for org.w3c.dom.Node definition code for org.w3c.dom.Node
All Known Subinterfaces:
HTMLAnchorElement sample code for org.w3c.dom.html.HTMLAnchorElement definition code for org.w3c.dom.html.HTMLAnchorElement , HTMLAppletElement sample code for org.w3c.dom.html.HTMLAppletElement definition code for org.w3c.dom.html.HTMLAppletElement , HTMLAreaElement sample code for org.w3c.dom.html.HTMLAreaElement definition code for org.w3c.dom.html.HTMLAreaElement , HTMLBaseElement sample code for org.w3c.dom.html.HTMLBaseElement definition code for org.w3c.dom.html.HTMLBaseElement , HTMLBaseFontElement sample code for org.w3c.dom.html.HTMLBaseFontElement definition code for org.w3c.dom.html.HTMLBaseFontElement , HTMLBodyElement sample code for org.w3c.dom.html.HTMLBodyElement definition code for org.w3c.dom.html.HTMLBodyElement , HTMLBRElement sample code for org.w3c.dom.html.HTMLBRElement definition code for org.w3c.dom.html.HTMLBRElement , HTMLButtonElement sample code for org.w3c.dom.html.HTMLButtonElement definition code for org.w3c.dom.html.HTMLButtonElement , HTMLDirectoryElement sample code for org.w3c.dom.html.HTMLDirectoryElement definition code for org.w3c.dom.html.HTMLDirectoryElement , HTMLDivElement sample code for org.w3c.dom.html.HTMLDivElement definition code for org.w3c.dom.html.HTMLDivElement , HTMLDListElement sample code for org.w3c.dom.html.HTMLDListElement definition code for org.w3c.dom.html.HTMLDListElement , HTMLElement sample code for org.w3c.dom.html.HTMLElement definition code for org.w3c.dom.html.HTMLElement , HTMLFieldSetElement sample code for org.w3c.dom.html.HTMLFieldSetElement definition code for org.w3c.dom.html.HTMLFieldSetElement , HTMLFontElement sample code for org.w3c.dom.html.HTMLFontElement definition code for org.w3c.dom.html.HTMLFontElement , HTMLFormElement sample code for org.w3c.dom.html.HTMLFormElement definition code for org.w3c.dom.html.HTMLFormElement , HTMLFrameElement sample code for org.w3c.dom.html.HTMLFrameElement definition code for org.w3c.dom.html.HTMLFrameElement , HTMLFrameSetElement sample code for org.w3c.dom.html.HTMLFrameSetElement definition code for org.w3c.dom.html.HTMLFrameSetElement , HTMLHeadElement sample code for org.w3c.dom.html.HTMLHeadElement definition code for org.w3c.dom.html.HTMLHeadElement , HTMLHeadingElement sample code for org.w3c.dom.html.HTMLHeadingElement definition code for org.w3c.dom.html.HTMLHeadingElement , HTMLHRElement sample code for org.w3c.dom.html.HTMLHRElement definition code for org.w3c.dom.html.HTMLHRElement , HTMLHtmlElement sample code for org.w3c.dom.html.HTMLHtmlElement definition code for org.w3c.dom.html.HTMLHtmlElement , HTMLIFrameElement sample code for org.w3c.dom.html.HTMLIFrameElement definition code for org.w3c.dom.html.HTMLIFrameElement , HTMLImageElement sample code for org.w3c.dom.html.HTMLImageElement definition code for org.w3c.dom.html.HTMLImageElement , HTMLInputElement sample code for org.w3c.dom.html.HTMLInputElement definition code for org.w3c.dom.html.HTMLInputElement , HTMLIsIndexElement sample code for org.w3c.dom.html.HTMLIsIndexElement definition code for org.w3c.dom.html.HTMLIsIndexElement , HTMLLabelElement sample code for org.w3c.dom.html.HTMLLabelElement definition code for org.w3c.dom.html.HTMLLabelElement , HTMLLegendElement sample code for org.w3c.dom.html.HTMLLegendElement definition code for org.w3c.dom.html.HTMLLegendElement , HTMLLIElement sample code for org.w3c.dom.html.HTMLLIElement definition code for org.w3c.dom.html.HTMLLIElement , HTMLLinkElement sample code for org.w3c.dom.html.HTMLLinkElement definition code for org.w3c.dom.html.HTMLLinkElement , HTMLMapElement sample code for org.w3c.dom.html.HTMLMapElement definition code for org.w3c.dom.html.HTMLMapElement , HTMLMenuElement sample code for org.w3c.dom.html.HTMLMenuElement definition code for org.w3c.dom.html.HTMLMenuElement , HTMLMetaElement sample code for org.w3c.dom.html.HTMLMetaElement definition code for org.w3c.dom.html.HTMLMetaElement , HTMLModElement sample code for org.w3c.dom.html.HTMLModElement definition code for org.w3c.dom.html.HTMLModElement , HTMLObjectElement sample code for org.w3c.dom.html.HTMLObjectElement definition code for org.w3c.dom.html.HTMLObjectElement , HTMLOListElement sample code for org.w3c.dom.html.HTMLOListElement definition code for org.w3c.dom.html.HTMLOListElement , HTMLOptGroupElement sample code for org.w3c.dom.html.HTMLOptGroupElement definition code for org.w3c.dom.html.HTMLOptGroupElement , HTMLOptionElement sample code for org.w3c.dom.html.HTMLOptionElement definition code for org.w3c.dom.html.HTMLOptionElement , HTMLParagraphElement sample code for org.w3c.dom.html.HTMLParagraphElement definition code for org.w3c.dom.html.HTMLParagraphElement , HTMLParamElement sample code for org.w3c.dom.html.HTMLParamElement definition code for org.w3c.dom.html.HTMLParamElement , HTMLPreElement sample code for org.w3c.dom.html.HTMLPreElement definition code for org.w3c.dom.html.HTMLPreElement , HTMLQuoteElement sample code for org.w3c.dom.html.HTMLQuoteElement definition code for org.w3c.dom.html.HTMLQuoteElement , HTMLScriptElement sample code for org.w3c.dom.html.HTMLScriptElement definition code for org.w3c.dom.html.HTMLScriptElement , HTMLSelectElement sample code for org.w3c.dom.html.HTMLSelectElement definition code for org.w3c.dom.html.HTMLSelectElement , HTMLStyleElement sample code for org.w3c.dom.html.HTMLStyleElement definition code for org.w3c.dom.html.HTMLStyleElement , HTMLTableCaptionElement sample code for org.w3c.dom.html.HTMLTableCaptionElement definition code for org.w3c.dom.html.HTMLTableCaptionElement , HTMLTableCellElement sample code for org.w3c.dom.html.HTMLTableCellElement definition code for org.w3c.dom.html.HTMLTableCellElement , HTMLTableColElement sample code for org.w3c.dom.html.HTMLTableColElement definition code for org.w3c.dom.html.HTMLTableColElement , HTMLTableElement sample code for org.w3c.dom.html.HTMLTableElement definition code for org.w3c.dom.html.HTMLTableElement , HTMLTableRowElement sample code for org.w3c.dom.html.HTMLTableRowElement definition code for org.w3c.dom.html.HTMLTableRowElement , HTMLTableSectionElement sample code for org.w3c.dom.html.HTMLTableSectionElement definition code for org.w3c.dom.html.HTMLTableSectionElement , HTMLTextAreaElement sample code for org.w3c.dom.html.HTMLTextAreaElement definition code for org.w3c.dom.html.HTMLTextAreaElement , HTMLTitleElement sample code for org.w3c.dom.html.HTMLTitleElement definition code for org.w3c.dom.html.HTMLTitleElement , HTMLUListElement sample code for org.w3c.dom.html.HTMLUListElement definition code for org.w3c.dom.html.HTMLUListElement
All Known Implementing Classes:
IIOMetadataNode sample code for javax.imageio.metadata.IIOMetadataNode definition code for javax.imageio.metadata.IIOMetadataNode

public interface Element
extends Node sample code for org.w3c.dom.Node definition code for org.w3c.dom.Node

The Element interface represents an element in an HTML or XML document. Elements may have attributes associated with them; since the Element interface inherits from Node, the generic Node interface attribute attributes may be used to retrieve the set of all attributes for an element. There are methods on the Element interface to retrieve either an Attr object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an Attr object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.

Note: In DOM Level 2, the method normalize is inherited from the Node interface where it was moved.

See also the Document Object Model (DOM) Level 3 Core Specification.


Field Summary
 
Fields inherited from interface org.w3c.dom.Node sample code for org.w3c.dom.Node definition code for org.w3c.dom.Node
ATTRIBUTE_NODE sample code for org.w3c.dom.Node.ATTRIBUTE_NODE definition code for org.w3c.dom.Node.ATTRIBUTE_NODE , CDATA_SECTION_NODE sample code for org.w3c.dom.Node.CDATA_SECTION_NODE definition code for org.w3c.dom.Node.CDATA_SECTION_NODE , COMMENT_NODE sample code for org.w3c.dom.Node.COMMENT_NODE definition code for org.w3c.dom.Node.COMMENT_NODE , DOCUMENT_FRAGMENT_NODE sample code for org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE definition code for org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE , DOCUMENT_NODE sample code for org.w3c.dom.Node.DOCUMENT_NODE definition code for org.w3c.dom.Node.DOCUMENT_NODE , DOCUMENT_POSITION_CONTAINED_BY sample code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINED_BY definition code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINED_BY , DOCUMENT_POSITION_CONTAINS sample code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINS definition code for org.w3c.dom.Node.DOCUMENT_POSITION_CONTAINS , DOCUMENT_POSITION_DISCONNECTED sample code for org.w3c.dom.Node.DOCUMENT_POSITION_DISCONNECTED definition code for org.w3c.dom.Node.DOCUMENT_POSITION_DISCONNECTED , DOCUMENT_POSITION_FOLLOWING sample code for org.w3c.dom.Node.DOCUMENT_POSITION_FOLLOWING definition code for org.w3c.dom.Node.DOCUMENT_POSITION_FOLLOWING , DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC sample code for org.w3c.dom.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC definition code for org.w3c.dom.Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC , DOCUMENT_POSITION_PRECEDING sample code for org.w3c.dom.Node.DOCUMENT_POSITION_PRECEDING definition code for org.w3c.dom.Node.DOCUMENT_POSITION_PRECEDING , DOCUMENT_TYPE_NODE sample code for org.w3c.dom.Node.DOCUMENT_TYPE_NODE definition code for org.w3c.dom.Node.DOCUMENT_TYPE_NODE , ELEMENT_NODE sample code for org.w3c.dom.Node.ELEMENT_NODE definition code for org.w3c.dom.Node.ELEMENT_NODE , ENTITY_NODE sample code for org.w3c.dom.Node.ENTITY_NODE definition code for org.w3c.dom.Node.ENTITY_NODE , ENTITY_REFERENCE_NODE sample code for org.w3c.dom.Node.ENTITY_REFERENCE_NODE definition code for org.w3c.dom.Node.ENTITY_REFERENCE_NODE , NOTATION_NODE sample code for org.w3c.dom.Node.NOTATION_NODE definition code for org.w3c.dom.Node.NOTATION_NODE , PROCESSING_INSTRUCTION_NODE sample code for org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE definition code for org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE , TEXT_NODE sample code for org.w3c.dom.Node.TEXT_NODE definition code for org.w3c.dom.Node.TEXT_NODE
 
Method Summary
 String sample code for java.lang.String definition code for java.lang.String getAttribute sample code for org.w3c.dom.Element.getAttribute(java.lang.String) definition code for org.w3c.dom.Element.getAttribute(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Retrieves an attribute value by name.
 Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr getAttributeNode sample code for org.w3c.dom.Element.getAttributeNode(java.lang.String) definition code for org.w3c.dom.Element.getAttributeNode(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Retrieves an attribute node by name.
 Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr getAttributeNodeNS sample code for org.w3c.dom.Element.getAttributeNodeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.getAttributeNodeNS(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  namespaceURI, String sample code for java.lang.String definition code for java.lang.String  localName)
          Retrieves an Attr node by local name and namespace URI.
 String sample code for java.lang.String definition code for java.lang.String getAttributeNS sample code for org.w3c.dom.Element.getAttributeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.getAttributeNS(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  namespaceURI, String sample code for java.lang.String definition code for java.lang.String  localName)
          Retrieves an attribute value by local name and namespace URI.
 NodeList sample code for org.w3c.dom.NodeList definition code for org.w3c.dom.NodeList getElementsByTagName sample code for org.w3c.dom.Element.getElementsByTagName(java.lang.String) definition code for org.w3c.dom.Element.getElementsByTagName(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Returns a NodeList of all descendant Elements with a given tag name, in document order.
 NodeList sample code for org.w3c.dom.NodeList definition code for org.w3c.dom.NodeList getElementsByTagNameNS sample code for org.w3c.dom.Element.getElementsByTagNameNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.getElementsByTagNameNS(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  namespaceURI, String sample code for java.lang.String definition code for java.lang.String  localName)
          Returns a NodeList of all the descendant Elements with a given local name and namespace URI in document order.
 TypeInfo sample code for org.w3c.dom.TypeInfo definition code for org.w3c.dom.TypeInfo getSchemaTypeInfo sample code for org.w3c.dom.Element.getSchemaTypeInfo() definition code for org.w3c.dom.Element.getSchemaTypeInfo() ()
          The type information associated with this element.
 String sample code for java.lang.String definition code for java.lang.String getTagName sample code for org.w3c.dom.Element.getTagName() definition code for org.w3c.dom.Element.getTagName() ()
          The name of the element.
 boolean hasAttribute sample code for org.w3c.dom.Element.hasAttribute(java.lang.String) definition code for org.w3c.dom.Element.hasAttribute(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.
 boolean hasAttributeNS sample code for org.w3c.dom.Element.hasAttributeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.hasAttributeNS(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  namespaceURI, String sample code for java.lang.String definition code for java.lang.String  localName)
          Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise.
 void removeAttribute sample code for org.w3c.dom.Element.removeAttribute(java.lang.String) definition code for org.w3c.dom.Element.removeAttribute(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name)
          Removes an attribute by name.
 Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr removeAttributeNode sample code for org.w3c.dom.Element.removeAttributeNode(org.w3c.dom.Attr) definition code for org.w3c.dom.Element.removeAttributeNode(org.w3c.dom.Attr) (Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  oldAttr)
          Removes the specified attribute node.
 void removeAttributeNS sample code for org.w3c.dom.Element.removeAttributeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.removeAttributeNS(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  namespaceURI, String sample code for java.lang.String definition code for java.lang.String  localName)
          Removes an attribute by local name and namespace URI.
 void setAttribute sample code for org.w3c.dom.Element.setAttribute(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.setAttribute(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  name, String sample code for java.lang.String definition code for java.lang.String  value)
          Adds a new attribute.
 Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr setAttributeNode sample code for org.w3c.dom.Element.setAttributeNode(org.w3c.dom.Attr) definition code for org.w3c.dom.Element.setAttributeNode(org.w3c.dom.Attr) (Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  newAttr)
          Adds a new attribute node.
 Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr setAttributeNodeNS sample code for org.w3c.dom.Element.setAttributeNodeNS(org.w3c.dom.Attr) definition code for org.w3c.dom.Element.setAttributeNodeNS(org.w3c.dom.Attr) (Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  newAttr)
          Adds a new attribute.
 void setAttributeNS sample code for org.w3c.dom.Element.setAttributeNS(java.lang.String, java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.setAttributeNS(java.lang.String, java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  namespaceURI, String sample code for java.lang.String definition code for java.lang.String  qualifiedName, String sample code for java.lang.String definition code for java.lang.String  value)
          Adds a new attribute.
 void setIdAttribute sample code for org.w3c.dom.Element.setIdAttribute(java.lang.String, boolean) definition code for org.w3c.dom.Element.setIdAttribute(java.lang.String, boolean) (String sample code for java.lang.String definition code for java.lang.String  name, boolean isId)
          If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .
 void setIdAttributeNode sample code for org.w3c.dom.Element.setIdAttributeNode(org.w3c.dom.Attr, boolean) definition code for org.w3c.dom.Element.setIdAttributeNode(org.w3c.dom.Attr, boolean) (Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  idAttr, boolean isId)
          If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .
 void setIdAttributeNS sample code for org.w3c.dom.Element.setIdAttributeNS(java.lang.String, java.lang.String, boolean) definition code for org.w3c.dom.Element.setIdAttributeNS(java.lang.String, java.lang.String, boolean) (String sample code for java.lang.String definition code for java.lang.String  namespaceURI, String sample code for java.lang.String definition code for java.lang.String  localName, boolean isId)
          If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute .
 
Methods inherited from interface org.w3c.dom.Node sample code for org.w3c.dom.Node definition code for org.w3c.dom.Node
appendChild sample code for org.w3c.dom.Node.appendChild(org.w3c.dom.Node) definition code for org.w3c.dom.Node.appendChild(org.w3c.dom.Node) , cloneNode sample code for org.w3c.dom.Node.cloneNode(boolean) definition code for org.w3c.dom.Node.cloneNode(boolean) , compareDocumentPosition sample code for org.w3c.dom.Node.compareDocumentPosition(org.w3c.dom.Node) definition code for org.w3c.dom.Node.compareDocumentPosition(org.w3c.dom.Node) , getAttributes sample code for org.w3c.dom.Node.getAttributes() definition code for org.w3c.dom.Node.getAttributes() , getBaseURI sample code for org.w3c.dom.Node.getBaseURI() definition code for org.w3c.dom.Node.getBaseURI() , getChildNodes sample code for org.w3c.dom.Node.getChildNodes() definition code for org.w3c.dom.Node.getChildNodes() , getFeature sample code for org.w3c.dom.Node.getFeature(java.lang.String, java.lang.String) definition code for org.w3c.dom.Node.getFeature(java.lang.String, java.lang.String) , getFirstChild sample code for org.w3c.dom.Node.getFirstChild() definition code for org.w3c.dom.Node.getFirstChild() , getLastChild sample code for org.w3c.dom.Node.getLastChild() definition code for org.w3c.dom.Node.getLastChild() , getLocalName sample code for org.w3c.dom.Node.getLocalName() definition code for org.w3c.dom.Node.getLocalName() , getNamespaceURI sample code for org.w3c.dom.Node.getNamespaceURI() definition code for org.w3c.dom.Node.getNamespaceURI() , getNextSibling sample code for org.w3c.dom.Node.getNextSibling() definition code for org.w3c.dom.Node.getNextSibling() , getNodeName sample code for org.w3c.dom.Node.getNodeName() definition code for org.w3c.dom.Node.getNodeName() , getNodeType sample code for org.w3c.dom.Node.getNodeType() definition code for org.w3c.dom.Node.getNodeType() , getNodeValue sample code for org.w3c.dom.Node.getNodeValue() definition code for org.w3c.dom.Node.getNodeValue() , getOwnerDocument sample code for org.w3c.dom.Node.getOwnerDocument() definition code for org.w3c.dom.Node.getOwnerDocument() , getParentNode sample code for org.w3c.dom.Node.getParentNode() definition code for org.w3c.dom.Node.getParentNode() , getPrefix sample code for org.w3c.dom.Node.getPrefix() definition code for org.w3c.dom.Node.getPrefix() , getPreviousSibling sample code for org.w3c.dom.Node.getPreviousSibling() definition code for org.w3c.dom.Node.getPreviousSibling() , getTextContent sample code for org.w3c.dom.Node.getTextContent() definition code for org.w3c.dom.Node.getTextContent() , getUserData sample code for org.w3c.dom.Node.getUserData(java.lang.String) definition code for org.w3c.dom.Node.getUserData(java.lang.String) , hasAttributes sample code for org.w3c.dom.Node.hasAttributes() definition code for org.w3c.dom.Node.hasAttributes() , hasChildNodes sample code for org.w3c.dom.Node.hasChildNodes() definition code for org.w3c.dom.Node.hasChildNodes() , insertBefore sample code for org.w3c.dom.Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) definition code for org.w3c.dom.Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node) , isDefaultNamespace sample code for org.w3c.dom.Node.isDefaultNamespace(java.lang.String) definition code for org.w3c.dom.Node.isDefaultNamespace(java.lang.String) , isEqualNode sample code for org.w3c.dom.Node.isEqualNode(org.w3c.dom.Node) definition code for org.w3c.dom.Node.isEqualNode(org.w3c.dom.Node) , isSameNode sample code for org.w3c.dom.Node.isSameNode(org.w3c.dom.Node) definition code for org.w3c.dom.Node.isSameNode(org.w3c.dom.Node) , isSupported sample code for org.w3c.dom.Node.isSupported(java.lang.String, java.lang.String) definition code for org.w3c.dom.Node.isSupported(java.lang.String, java.lang.String) , lookupNamespaceURI sample code for org.w3c.dom.Node.lookupNamespaceURI(java.lang.String) definition code for org.w3c.dom.Node.lookupNamespaceURI(java.lang.String) , lookupPrefix sample code for org.w3c.dom.Node.lookupPrefix(java.lang.String) definition code for org.w3c.dom.Node.lookupPrefix(java.lang.String) , normalize sample code for org.w3c.dom.Node.normalize() definition code for org.w3c.dom.Node.normalize() , removeChild sample code for org.w3c.dom.Node.removeChild(org.w3c.dom.Node) definition code for org.w3c.dom.Node.removeChild(org.w3c.dom.Node) , replaceChild sample code for org.w3c.dom.Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) definition code for org.w3c.dom.Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node) , setNodeValue sample code for org.w3c.dom.Node.setNodeValue(java.lang.String) definition code for org.w3c.dom.Node.setNodeValue(java.lang.String) , setPrefix sample code for org.w3c.dom.Node.setPrefix(java.lang.String) definition code for org.w3c.dom.Node.setPrefix(java.lang.String) , setTextContent sample code for org.w3c.dom.Node.setTextContent(java.lang.String) definition code for org.w3c.dom.Node.setTextContent(java.lang.String) , setUserData sample code for org.w3c.dom.Node.setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler) definition code for org.w3c.dom.Node.setUserData(java.lang.String, java.lang.Object, org.w3c.dom.UserDataHandler)
 

Method Detail

getTagName sample code for org.w3c.dom.Element.getTagName() definition code for org.w3c.dom.Element.getTagName()

String sample code for java.lang.String definition code for java.lang.String  getTagName()
The name of the element. If Node.localName is different from null, this attribute is a qualified name. For example, in:
 <elementExample id="demo"> ... 
 </elementExample> , 
tagName has the value "elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the tagName of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.


getAttribute sample code for org.w3c.dom.Element.getAttribute(java.lang.String) definition code for org.w3c.dom.Element.getAttribute(java.lang.String)

String sample code for java.lang.String definition code for java.lang.String  getAttribute(String sample code for java.lang.String definition code for java.lang.String  name)
Retrieves an attribute value by name.

Parameters:
name - The name of the attribute to retrieve.
Returns:
The Attr value as a string, or the empty string if that attribute does not have a specified or default value.

setAttribute sample code for org.w3c.dom.Element.setAttribute(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.setAttribute(java.lang.String, java.lang.String)

void setAttribute(String sample code for java.lang.String definition code for java.lang.String  name,
                  String sample code for java.lang.String definition code for java.lang.String  value)
                  throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute.
To set an attribute with a qualified name and namespace URI, use the setAttributeNS method.

Parameters:
name - The name of the attribute to create or alter.
value - Value to set in string form.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

removeAttribute sample code for org.w3c.dom.Element.removeAttribute(java.lang.String) definition code for org.w3c.dom.Element.removeAttribute(java.lang.String)

void removeAttribute(String sample code for java.lang.String definition code for java.lang.String  name)
                     throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Removes an attribute by name. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
If no attribute with this name is found, this method has no effect.
To remove an attribute by local name and namespace URI, use the removeAttributeNS method.

Parameters:
name - The name of the attribute to remove.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

getAttributeNode sample code for org.w3c.dom.Element.getAttributeNode(java.lang.String) definition code for org.w3c.dom.Element.getAttributeNode(java.lang.String)

Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  getAttributeNode(String sample code for java.lang.String definition code for java.lang.String  name)
Retrieves an attribute node by name.
To retrieve an attribute node by qualified name and namespace URI, use the getAttributeNodeNS method.

Parameters:
name - The name (nodeName) of the attribute to retrieve.
Returns:
The Attr node with the specified name ( nodeName) or null if there is no such attribute.

setAttributeNode sample code for org.w3c.dom.Element.setAttributeNode(org.w3c.dom.Attr) definition code for org.w3c.dom.Element.setAttributeNode(org.w3c.dom.Attr)

Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  setAttributeNode(Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  newAttr)
                      throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Adds a new attribute node. If an attribute with that name ( nodeName) is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.
To add a new attribute node with a qualified name and namespace URI, use the setAttributeNodeNS method.

Parameters:
newAttr - The Attr node to add to the attribute list.
Returns:
If the newAttr attribute replaces an existing attribute, the replaced Attr node is returned, otherwise null is returned.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

removeAttributeNode sample code for org.w3c.dom.Element.removeAttributeNode(org.w3c.dom.Attr) definition code for org.w3c.dom.Element.removeAttributeNode(org.w3c.dom.Attr)

Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  removeAttributeNode(Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  oldAttr)
                         throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Removes the specified attribute node. If a default value for the removed Attr node is defined in the DTD, a new node immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.

Parameters:
oldAttr - The Attr node to remove from the attribute list.
Returns:
The Attr node that was removed.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if oldAttr is not an attribute of the element.

getElementsByTagName sample code for org.w3c.dom.Element.getElementsByTagName(java.lang.String) definition code for org.w3c.dom.Element.getElementsByTagName(java.lang.String)

NodeList sample code for org.w3c.dom.NodeList definition code for org.w3c.dom.NodeList  getElementsByTagName(String sample code for java.lang.String definition code for java.lang.String  name)
Returns a NodeList of all descendant Elements with a given tag name, in document order.

Parameters:
name - The name of the tag to match on. The special value "*" matches all tags.
Returns:
A list of matching Element nodes.

getAttributeNS sample code for org.w3c.dom.Element.getAttributeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.getAttributeNS(java.lang.String, java.lang.String)

String sample code for java.lang.String definition code for java.lang.String  getAttributeNS(String sample code for java.lang.String definition code for java.lang.String  namespaceURI,
                      String sample code for java.lang.String definition code for java.lang.String  localName)
                      throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Retrieves an attribute value by local name and namespace URI.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters:
namespaceURI - The namespace URI of the attribute to retrieve.
localName - The local name of the attribute to retrieve.
Returns:
The Attr value as a string, or the empty string if that attribute does not have a specified or default value.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
Since:
DOM Level 2

setAttributeNS sample code for org.w3c.dom.Element.setAttributeNS(java.lang.String, java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.setAttributeNS(java.lang.String, java.lang.String, java.lang.String)

void setAttributeNS(String sample code for java.lang.String definition code for java.lang.String  namespaceURI,
                    String sample code for java.lang.String definition code for java.lang.String  qualifiedName,
                    String sample code for java.lang.String definition code for java.lang.String  value)
                    throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the qualifiedName, and its value is changed to be the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNodeNS or setAttributeNode to assign it as the value of an attribute.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters:
namespaceURI - The namespace URI of the attribute to create or alter.
qualifiedName - The qualified name of the attribute to create or alter.
value - The value to set in string form.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NAMESPACE_ERR: Raised if the qualifiedName is malformed per the Namespaces in XML specification, if the qualifiedName has a prefix and the namespaceURI is null, if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from " http://www.w3.org/XML/1998/namespace", if the qualifiedName or its prefix is "xmlns" and the namespaceURI is different from "http://www.w3.org/2000/xmlns/", or if the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the qualifiedName nor its prefix is "xmlns".
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
Since:
DOM Level 2

removeAttributeNS sample code for org.w3c.dom.Element.removeAttributeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.removeAttributeNS(java.lang.String, java.lang.String)

void removeAttributeNS(String sample code for java.lang.String definition code for java.lang.String  namespaceURI,
                       String sample code for java.lang.String definition code for java.lang.String  localName)
                       throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Removes an attribute by local name and namespace URI. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use Document.normalizeDocument() to guarantee this information is up-to-date.
If no attribute with this local name and namespace URI is found, this method has no effect.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters:
namespaceURI - The namespace URI of the attribute to remove.
localName - The local name of the attribute to remove.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
Since:
DOM Level 2

getAttributeNodeNS sample code for org.w3c.dom.Element.getAttributeNodeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.getAttributeNodeNS(java.lang.String, java.lang.String)

Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  getAttributeNodeNS(String sample code for java.lang.String definition code for java.lang.String  namespaceURI,
                        String sample code for java.lang.String definition code for java.lang.String  localName)
                        throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Retrieves an Attr node by local name and namespace URI.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters:
namespaceURI - The namespace URI of the attribute to retrieve.
localName - The local name of the attribute to retrieve.
Returns:
The Attr node with the specified attribute local name and namespace URI or null if there is no such attribute.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
Since:
DOM Level 2

setAttributeNodeNS sample code for org.w3c.dom.Element.setAttributeNodeNS(org.w3c.dom.Attr) definition code for org.w3c.dom.Element.setAttributeNodeNS(org.w3c.dom.Attr)

Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  setAttributeNodeNS(Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  newAttr)
                        throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters:
newAttr - The Attr node to add to the attribute list.
Returns:
If the newAttr attribute replaces an existing attribute with the same local name and namespace URI, the replaced Attr node is returned, otherwise null is returned.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
Since:
DOM Level 2

getElementsByTagNameNS sample code for org.w3c.dom.Element.getElementsByTagNameNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.getElementsByTagNameNS(java.lang.String, java.lang.String)

NodeList sample code for org.w3c.dom.NodeList definition code for org.w3c.dom.NodeList  getElementsByTagNameNS(String sample code for java.lang.String definition code for java.lang.String  namespaceURI,
                                String sample code for java.lang.String definition code for java.lang.String  localName)
                                throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Returns a NodeList of all the descendant Elements with a given local name and namespace URI in document order.

Parameters:
namespaceURI - The namespace URI of the elements to match on. The special value "*" matches all namespaces.
localName - The local name of the elements to match on. The special value "*" matches all local names.
Returns:
A new NodeList object containing all the matched Elements.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
Since:
DOM Level 2

hasAttribute sample code for org.w3c.dom.Element.hasAttribute(java.lang.String) definition code for org.w3c.dom.Element.hasAttribute(java.lang.String)

boolean hasAttribute(String sample code for java.lang.String definition code for java.lang.String  name)
Returns true when an attribute with a given name is specified on this element or has a default value, false otherwise.

Parameters:
name - The name of the attribute to look for.
Returns:
true if an attribute with the given name is specified on this element or has a default value, false otherwise.
Since:
DOM Level 2

hasAttributeNS sample code for org.w3c.dom.Element.hasAttributeNS(java.lang.String, java.lang.String) definition code for org.w3c.dom.Element.hasAttributeNS(java.lang.String, java.lang.String)

boolean hasAttributeNS(String sample code for java.lang.String definition code for java.lang.String  namespaceURI,
                       String sample code for java.lang.String definition code for java.lang.String  localName)
                       throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise.
Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Parameters:
namespaceURI - The namespace URI of the attribute to look for.
localName - The local name of the attribute to look for.
Returns:
true if an attribute with the given local name and namespace URI is specified or has a default value on this element, false otherwise.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).
Since:
DOM Level 2

getSchemaTypeInfo sample code for org.w3c.dom.Element.getSchemaTypeInfo() definition code for org.w3c.dom.Element.getSchemaTypeInfo()

TypeInfo sample code for org.w3c.dom.TypeInfo definition code for org.w3c.dom.TypeInfo  getSchemaTypeInfo()
The type information associated with this element.

Since:
DOM Level 3

setIdAttribute sample code for org.w3c.dom.Element.setIdAttribute(java.lang.String, boolean) definition code for org.w3c.dom.Element.setIdAttribute(java.lang.String, boolean)

void setIdAttribute(String sample code for java.lang.String definition code for java.lang.String  name,
                    boolean isId)
                    throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute . This affects the value of Attr.isId and the behavior of Document.getElementById, but does not change any schema that may be in use, in particular this does not affect the Attr.schemaTypeInfo of the specified Attr node. Use the value false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.
To specify an attribute by local name and namespace URI, use the setIdAttributeNS method.

Parameters:
name - The name of the attribute.
isId - Whether the attribute is a of type ID.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.
Since:
DOM Level 3

setIdAttributeNS sample code for org.w3c.dom.Element.setIdAttributeNS(java.lang.String, java.lang.String, boolean) definition code for org.w3c.dom.Element.setIdAttributeNS(java.lang.String, java.lang.String, boolean)

void setIdAttributeNS(String sample code for java.lang.String definition code for java.lang.String  namespaceURI,
                      String sample code for java.lang.String definition code for java.lang.String  localName,
                      boolean isId)
                      throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute . This affects the value of Attr.isId and the behavior of Document.getElementById, but does not change any schema that may be in use, in particular this does not affect the Attr.schemaTypeInfo of the specified Attr node. Use the value false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.

Parameters:
namespaceURI - The namespace URI of the attribute.
localName - The local name of the attribute.
isId - Whether the attribute is a of type ID.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.
Since:
DOM Level 3

setIdAttributeNode sample code for org.w3c.dom.Element.setIdAttributeNode(org.w3c.dom.Attr, boolean) definition code for org.w3c.dom.Element.setIdAttributeNode(org.w3c.dom.Attr, boolean)

void setIdAttributeNode(Attr sample code for org.w3c.dom.Attr definition code for org.w3c.dom.Attr  idAttr,
                        boolean isId)
                        throws DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException 
If the parameter isId is true, this method declares the specified attribute to be a user-determined ID attribute . This affects the value of Attr.isId and the behavior of Document.getElementById, but does not change any schema that may be in use, in particular this does not affect the Attr.schemaTypeInfo of the specified Attr node. Use the value false for the parameter isId to undeclare an attribute for being a user-determined ID attribute.

Parameters:
idAttr - The attribute node.
isId - Whether the attribute is a of type ID.
Throws:
DOMException sample code for org.w3c.dom.DOMException definition code for org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.
Since:
DOM Level 3