1 | |
2 | root = doc.getDocumentElement(); |
3 | //print tag name |
4 | System.out.println(root.getTagName()); |
5 | //get first child element of the root |
6 | docElem = (Node) root.getFirstChild(); |
7 | //print tag name |
8 | System.out.println(docElem.getTagName()); |
9 | //print element type |
10 | System.out.println(docElem.getNodeType()); |
11 | //print node value |
12 | docElem1 = (Text) docElem.getFirstChild(); |
13 | System.out.println(docElem1.getNodeValue()); |