|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Element
public Element
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.
| Field Summary | |
|---|---|
String |
tagName
The name of the element. |
| Fields inherited from class Node |
|---|
childNodes, firstChild, lastChild, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, previousSibling |
| Method Summary | |
|---|---|
String |
getAttribute(String name)
Retrieves an attribute value by name. |
NodeList |
getElementsByTagName(String name)
Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are encountered in a preorder traversal of this Element tree. |
void |
removeAttribute(String name)
Removes an attribute by name. |
void |
setAttribute(String name,
String value)
Adds a new attribute. |
| Methods inherited from class Node |
|---|
appendChild, hasChildNodes, insertBefore, removeChild, replaceChild |
| Field Detail |
|---|
final String tagName
| Method Detail |
|---|
NodeList getElementsByTagName(String name)
name - The name of the tag to match on. The special value "*" matches all tags.
void removeAttribute(String name)
name - The name of the attribute to remove.
void setAttribute(String name,
String value)
name - The name of the attribute to create or alter.value - Value to set in string form.String getAttribute(String name)
name - The name of the attribute to retrieve.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||