Basic HTML version of Foils prepared August 1 99

Foil 37 Browsing Document with DOM Parser

From Advanced XML and its applications CPS714 Computational Science Information Track -- July 7 99. by Lukasz Beca


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());



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Aug 1 1999