O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Our Temporary Document

Now that we have the document, we need to add the extended price and totals to it. Let's start by pulling out the price and quantity information in Listing 6.33.

Listing 6.33. Retrieving Price and Quantity Information
...
5a: import org.apache.xerces.dom.ElementImpl;
...
122:
123:        ElementImpl tempDocRoot = (ElementImpl)tempDoc.getFirstChild();
					124:        NodeList items = tempDocRoot.getElementsByTagName("ord:item");
					125:        for (int i=0; i < items.getLength(); i++) {
					126:            ElementImpl thisItem = (ElementImpl)items.item(i);
					127:
					128:            NodeList quantityNodeList =
					                       thisItem.
getElementsByTagName("ord:quantity");
					129: Node ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required