root = doc.getDocumentElement(); |
//print tag name |
System.out.println(root.getTagName()); |
//get first child element of the root |
docElem = (Node) root.getFirstChild(); |
//print tag name |
System.out.println(docElem.getTagName()); |
//print element type |
System.out.println(docElem.getNodeType()); |
//print node value |
docElem1 = (Text) docElem.getFirstChild(); |
System.out.println(docElem1.getNodeValue()); |