Manipulating In-Memory Documents
Now that we've created an order, we need to give the user a way to review the items that have been added to it. Our algorithm for doing that might look something like this:
Check for an existing order If the order exists, display information on each item: Get the order item Retrieve information on the item from products.xml Display the information on that item Else Display a message that there is no current order
Let's think about how we want to do this. Looking at the orders.xml file, a typical order might look similar to this:
<order order_id="To1010mC7161452772864825At"> <order_status>open</order_status> <item product_id="RC2342"> <quantity>3</quantity> </item> <item product_id="QA3452"> <quantity>1</quantity> ...
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.