Tip, Using a DOM NodeFilter

Control which nodes are visible to a TreeWalker or NodeIterator

From the developerWorks archives

Nicholas Chase

Date archived: February 24, 2017 | First published: November 01, 2002

XML's DOM Level 2 Traversal module provides two new objects, the TreeWalker and the NodeIterator, which simplify the process of navigating a Document. More than that, the module defines a NodeFilter, which can be used to programmatically control what nodes are visible to the TreeWalker or NodeFilter. This tip shows you how to create a NodeFilter as well as a Traversal object that uses it.

This content is no longer being updated or maintained. The full article is provided "as is" in a PDF file. Given the rapid evolution of technology, some steps and illustrations may have changed.

ArticleTitle=Tip: Using a DOM NodeFilter