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 ...

Get XML and Java™ from scratch 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.