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

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

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