I have an inventory record XML file to store the quantity of each item.
<Inventory>
<Item>
<ManufacturerName>Brand1</ManufacturerName>
<ProductType>TV</ProductType>
<Quantity>146</Quantity>
</Item>
<Item>
<ManufacturerName>Brand2</ManufacturerName>
<ProductType>TV</ProductType>
<Quantity>221</Quantity>
</Item>
<Item>
<ManufacturerName>Brand3</ManufacturerName>
<ProductType>TV</ProductType>
<Quantity>36</Quantity>
</Item>
</Inventory>
In my java program, if I get a request for a certain item, I check the quantity of items of that type remaining (Quantity parameter) and, if there are enough, subtract that amount from the XML file. I can do this by looping through each node of the XML and checking the one I want, but I was hoping there was a faster way of accessing one particular node right away. Maybe the structure of the XML file can be changed to make it more accessible but I can't think of one.