1
public
void
read(Element e) {
2 if (e.nodeCount() > 0 ) {
3 Iterator <?> it = e.elementIterator();
4 while (it.hasNext()) {
5 Element ele = (Element) it.next();
6 read(ele);
7 System.out.println( " Element : " + ele.getName() + " Path "
8 + ele.getUniquePath());
9
10 if (ele.attributeCount() > 0 ) {
11 Iterator <?> ait = ele.attributeIterator();
12 System.out.print( " Data : [ " );
13 while (ait.hasNext()) {
14 Attribute attribute = (Attribute) ait.next();
15 System.out.print(attribute.getName() + " : "
16 + attribute.getData() + " " );
17 }
18 System.out.print( " ] " );
19 System.out.println();
20 }
21 }
22 }
23
24 }
2 if (e.nodeCount() > 0 ) {
3 Iterator <?> it = e.elementIterator();
4 while (it.hasNext()) {
5 Element ele = (Element) it.next();
6 read(ele);
7 System.out.println( " Element : " + ele.getName() + " Path "
8 + ele.getUniquePath());
9
10 if (ele.attributeCount() > 0 ) {
11 Iterator <?> ait = ele.attributeIterator();
12 System.out.print( " Data : [ " );
13 while (ait.hasNext()) {
14 Attribute attribute = (Attribute) ait.next();
15 System.out.print(attribute.getName() + " : "
16 + attribute.getData() + " " );
17 }
18 System.out.print( " ] " );
19 System.out.println();
20 }
21 }
22 }
23
24 }