public void read(Element e) {
if (e.nodeCount() > 0) {
Iterator<?> it = e.elementIterator();
while (it.hasNext()) {
Element ele = (Element) it.next();
read(ele);
System.out.println("Element :" + ele.getName() + " Path "
+ ele.getUniquePath());
if (ele.attributeCount() > 0) {
Iterator<?> ait = ele.attributeIterator();
System.out.print(" Data : [ ");
while (ait.hasNext()) {
Attribute attribute = (Attribute) ait.next();
System.out.print(attribute.getName() + " : "
+ attribute.getData() + " ");
}
System.out.print(" ]");
System.out.println();
}
}
}
}
if (e.nodeCount() > 0) {
Iterator<?> it = e.elementIterator();
while (it.hasNext()) {
Element ele = (Element) it.next();
read(ele);
System.out.println("Element :" + ele.getName() + " Path "
+ ele.getUniquePath());
if (ele.attributeCount() > 0) {
Iterator<?> ait = ele.attributeIterator();
System.out.print(" Data : [ ");
while (ait.hasNext()) {
Attribute attribute = (Attribute) ait.next();
System.out.print(attribute.getName() + " : "
+ attribute.getData() + " ");
}
System.out.print(" ]");
System.out.println();
}
}
}
}