Basic HTML version of Foils prepared July 6 99

Foil 15 Document Object Model - Example

From Introduction to XML CPS714 Computational Science Information Track -- June 9 99. by Lukasz Beca


root = doc.getDocumentElement();
//print tag name
System.out.println(root.getTagName());
//get first child element of the root
docElem = (Node) root.getFirstChild();
//print tag name
System.out.println(docElem.getTagName());
//print element type
System.out.println(docElem.getNodeType());
//print node value
docElem1 = (Text) docElem.getFirstChild();
System.out.println(docElem1.getNodeValue());



© 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 Tue Jul 6 1999