Basic HTML version of Foils prepared August 1 99

Foil 40 Modification of Document

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


1 document = parser.readStream(in);
2 root = document.getDocumentElement();
3 System.out.println("Node name: " + root.getNodeName());
4 publications = root.getElementsByTagName("publication");
5 publication = (Element) publications.item(0);
6 System.out.println("Node name: "+publication.getNodeName());
7 title = (Element) (publication.getElementsByTagName("title")).item(0);
8 System.out.println("Node name: " + title.getNodeName());
9
10 titleText = (Text) title.getFirstChild();
11 System.out.println("Title: " + titleText.getData());
12
13 titleText.setData("Something More Interesting");
14 System.out.println("Title: " + titleText.getData());
15
16 pw = new PrintWriter(new BufferedWriter (new FileWriter(args[0])));
17
18 document.printWithFormat(pw);

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