The previous example displayed the entire document, but you can be more selective than that through a process called filtering. When you filter a document, you extract only those elements you're interested in.
Here's a new example named searcherSAX.java. In this case, I'll let the user specify what document to search and what element name to search for, like this, which will display all <ITEM> elements in customer.xml:
%java searcherSAX customer.xml ITEM
This program is not difficult to write, now that we've written the indenting parser example. Note, however, that we must handle not just the specific element the user is searching for, but also the element's children that are contained inside the element. I'll adapt ...