In this tutorial, you will see the use of different method of Attribute class.
In this tutorial, you will see the use of different method of Attribute class.This tutorial explains the use of the getParent() and getQualifiedName(). These methods are present in the Attribute class. The Attribute class is available part of JDOM library.
Example discussed in this section explains the use of getPatent() and getQualifiedName() methods. After reading the examples you will be able to apply the logic to use correctly in your program.
The getChild(java.lang.String name)
method of Element class returns the child element.
The getParent() method of
Attribute class returns parent of the associated attribute.
The getQualifiedName() method of Attribute class returns name of attribute.
We will be using the following XML file.
book.xml
<?xml version="1.0" encoding="UTF-8"?>
|
AddAttributeList.java
package roseindia;
|
Child Name of root: [Element: <book/>]
Parent of attribute : [Element: <book/>] Name of attribute : id |