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


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

in Table To:


© 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