Graphic Java
Create XML files using JSP
David Geary
Listing 3.

package com.companyName.beans.model;

import java.util.*;

public class Inventory implements {
	private Vector items = new Vector();

	public Inventory() {
	  items.addElement(new Item("Antique broach",
						"from the early 1700's",

	// more items like the one above ...
	public Iterator getItems() {
		return items.iterator();
	public void printXml(PrintStream s) {

		Iterator it = getItems();
		while(it.hasNext()) {
			Item item = (Item);
			item.printXml(s, 1);

About the Author

David Geary was the lead engineer for the Java Management API GUI toolkit, and is now an independent Java consultant. David is the author of Graphic Java—Mastering the JFC. He can be contacted at [email protected].