document = parser.getDocument(); |
root = document.getDocumentElement(); |
System.out.println("Node name: " + root.getNodeName()); |
publications = root.getElementsByTagName("publication"); |
publication = (Element) publications.item(0); |
System.out.println("Node name: "+publication.getNodeName()); |
author = (Element) (publication.getElementsByTagName("author")).item(0); |
System.out.println("Node name: " + author.getNodeName()); |
lastname = (Element) (author.getElementsByTagName("lastname")).item(0); |
System.out.println("Node name: " + lastname.getNodeName()); |
nameString = (Text) lastname.getFirstChild(); |
System.out.println("Last Name: " + nameString.getData()); |