1 | document = parser.getDocument(); |
2 | root = document.getDocumentElement(); |
3 | System.out.println("Node name: " + root.getNodeName()); |
4 | |
5 | publications = root.getElementsByTagName("publication"); |
6 | publication = (Element) publications.item(0); |
7 | System.out.println("Node name: "+publication.getNodeName()); |
8 | |
9 | author = (Element) (publication.getElementsByTagName("author")).item(0); |
10 | System.out.println("Node name: " + author.getNodeName()); |
11 | |
12 | lastname = (Element) (author.getElementsByTagName("lastname")).item(0); |
13 | System.out.println("Node name: " + lastname.getNodeName()); |
14 | |
15 | nameString = (Text) lastname.getFirstChild(); |
16 | System.out.println("Last Name: " + nameString.getData()); |