Using a Collection

Before we get into developing our own collection-based classes around the DOM, an example of using one of the predefined collections is in order. Listing 6.1 makes use of several of the collection classes and allows for manipulating a list of book titles. In the following sections, we will expand these ideas to develop our own simple collections on top of the DOM.

Note

It's really a shame that when the DOM II specification was being drafted its developers didn't spend more time examining the Java 2.0 collections interfaces. Back in Chapter 4 where we discussed the DOM II interfaces, you might remember the nodeIterator interface. The nodeIterator goes much of the way toward providing a traditional JDK 2.0 collection. With only ...

Get XML Development with Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.