XML DOM - XML DOM Element Object - DOM Element Object Method getAttribute - XML DOM

Explain the getAttribute method of the Element Object

The value of the attribute of a specified element is provided by the getAttribute method.

Syntax

The syntax for the getAttribute method is as follows:

S.No.
Parameter & Description
1
Name
It holds the name of the attribute to retrieve.

Example

The contents of the node.xml are as follows:

The illustration below displays the getAttribute method usage.

Execution

The file is saved as elementattribute_getattribute.html on the server path and this file should be on the same path as that of node.xml in the server. The output appears as follows:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

XML DOM Topics