Interface Element

public interface Element
extends Node
This interface represents XML DOM elements, which are the basic building block of XML. An example follows:

      Some text more text
   

Methods

getAttribute(String)This method retrieves the attribute which has a name of name.
getAttributeNode(String)This method retrieves the attribute node which has a name of name.
getElementsByTagName(String)This method retrieves the elements by tag name which has a name of name.
getTagName()This method retrieves the tag name.
hasAttribute(String)This method determines whether this Element has an attribute with the supplied name.
removeAttribute(String)This method removes the attribute which has the specified name.
setAttribute(String, String)This method sets the attribute specified by name to value.

Method Detail

getAttribute

public String getAttribute(String name)
This method retrieves the attribute which has a name of name.

Parameters

name
the name of the attribute to get the value of

Return Value

the value of the attribute specified by name

getAttributeNode

public Attr getAttributeNode(String name)
This method retrieves the attribute node which has a name of name. This Attr will have the same value as would be gotten with getAttribute.

Parameters

name
the name of the Attr to get

Return Value

the attribute node of this Elementwhich has a name of name

getElementsByTagName

public NodeList getElementsByTagName(String name)
This method retrieves the elements by tag name which has a name of name.

Parameters

name
the name of the Element to get

Return Value

the elements by tag name of this Element which has a name of name

getTagName

public String getTagName()
This method retrieves the tag name.

Return Value

the tag name of this Element

hasAttribute

public boolean hasAttribute(String name)
This method determines whether this Element has an attribute with the supplied name.

Parameters

name
the name of the attribute

Return Value

true if this Element has an attribute that name.

removeAttribute

public void removeAttribute(String name)
This method removes the attribute which has the specified name.

Parameters

name
the name of the attribute to remove

setAttribute

public void setAttribute(String name, String value)
This method sets the attribute specified by name to value.

Parameters

name
the name of the attribute to set
value
the new value this attribute is to have