Completing the Circle

Now we have the database updated, so we need to go back and update the products.xml file with the new values. What we're going to do is move through the products.xml file, get the product_id, color, and location, and then check the database for the correct inventory value.

In Listing 8.25, we'll start by creating the application and pulling out the appropriate information from products.xml.

Listing 8.25. UpdateProduct.java: Retrieving Product Information from the XML File
 0: import java.util.*; 1: import java.io.*; 2: import org.apache.xerces.parsers.*; 3: import org.apache.xerces.dom.*; 4: import org.w3c.dom.*; 5: import org.apache.xml.serialize.*; 6: 7: public class UpdateProduct extends Object { 8: 9: public static void ...

Get XML and Java™ from scratch now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.