- 131 -
Element
Parent
: Node
Just as the name implies, the Element node represents the element construct from an
XML document. Most of the methods that exist solely for Elements are for managing
attributes.
Element Properties
tagName
Type
: String
Description
: This string property represents the tag name of the Element.
Comments
: This property is the same as nodeName on Elements. When dealing with
Elements, the two can be used interchangeably.
Element Methods
getAttribute(name)
Parameters
:
name
is a string value.
Return value
: String
Exceptions thrown
: None
Description
: This method returns a string that contains the contents of the attribute
named
name
.
setAttribute(name, value)
Parameters
:
name
and
value
are strings.
Return value
: None
Exceptions thrown
: None
Description
: If the attribute named
name
doesn’t exist, then it is created and given the
value
value
. If this attribute already exists, then the previous value is overwritten with
value
.