XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.

advertisement
 Resource Guide -> DOM Tutorials, XML and Java Tutorials -> Using DOM to Traverse XML

Using DOM to Traverse XML

Date: Mar. 18, 2001
Link: http://www.onjava.com/pub/a/onjava/2001/02/08/dom.html
Source Author or Organization: Stephanie Fesler, O'Reilly Network, ONJava.com

Current Java applications often need to retrieve or manipulate data via the parsing of XML documents. This tutorial takes the user through the two methods for navigating a Document Object Model (DOM) representation of the structure and content of XML or Extensible Hypertext Markup Language (XHTML) files: traversal of a horizontal (or "flat") representation, and traversal of a hierarchical representation (or "tree").

The article begins by identifying several levels of the DOM, with an overview of DOM Level 0 (i.e., the first requirements document, circa Navigator 3.0), and the DOM Level 2 Core, Views, Style, Events, and Traversal-Range Recommendations. The tutorial's examples concentrate on an Apache Software Foundation implementation of the DOM Level 2 Traversal-Range Recommendation, Xerces-J, its NodeIterator interface for traversing a horizontal representation, its TreeWalker interface for traversing a hierarchical representation and its NodeFilter interface for writing filters to determine which elements will be shown.