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


document = parser.readStream(in);
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());
title = (Element) (publication.getElementsByTagName("title")).item(0);
System.out.println("Node name: " + title.getNodeName());
titleText = (Text) title.getFirstChild();
System.out.println("Title: " + titleText.getData());
titleText.setData("Something More Interesting");
System.out.println("Title: " + titleText.getData());
pw = new PrintWriter(new BufferedWriter (new FileWriter(args[0])));
document.printWithFormat(pw);



© 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