Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. XML > Simple XML Processsing

10.1. Simple XML Processsing

Example 10-1 shows an XML file that contains details of a company's current inventory of widgets. We have each widget's part number, name, price, and current stock. This data might be generated by a stock control system.

Example 10-1. Stock control data

<inventory>
  <product id="0050">
    <name>Basic Widget</name>
    <price>49.99</price>
    <stock>2500</stock>
  </product>
  <product id="0051">
    <name>Cheap Widget</name>
    <price>29.99</price>
    <stock>5000</stock>
  </product>
  <product id="0101">
    <name>Super Widget</name>
    <price>99.99</price>
    <stock>1000</stock>
  </product>
  <product id="0102">
    <name>Ultra Widget</name>
    <price>149.99</price>
    <stock>500</stock>
  </product>
</inventory>

					  


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial