spacer
Yehuda Shiran December 26, 2001
Interpreting XML
Tips: December 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
HP to Microsoft: Thanks for Nothing
iPhone Remains Left Out as Android Scores Flash
The Year of Living the OpenSocial
The XML format is focused on the data itself. It may be structured in a very deep hierarchy. The following XML file contains the sales figures of MyDvd Rental Store Corporation for the months of January, February, and March. Notice how each piece of data is enclosed within a specific tag pair. The whole report is enclosed within the <sales> tag pair. The summary portion of the report is enclosed in a <summary> pair. Each line of the summary got its own tag pair. The data section is paired between <data> tags. Similarly, we have a tag pair for each month and for each week. The actual sales numbers are shown at the leaf cells of the hierarchy, within the <week> tag pair:

<?xml version="1.0" ?>
  <sales>
    <summary>
      <heading>MyDvd Rental Store</heading>
      <subhead>Periodical Sales Report</subhead>
      <description>Sales report for January, February, and March of 2001</description>
    </summary>
    <data>
      <month>
        <name>January 2001</name>
        <week number="1" dvds_rented="12000" />
        <week number="2" dvds_rented="15000" />
        <week number="3" dvds_rented="18000" />
        <week number="4" dvds_rented="11000" />		  
      </month>
      <month>
        <name>February 2001</name>
        <week number="1" dvds_rented="11000" />
        <week number="2" dvds_rented="12390" />
        <week number="3" dvds_rented="10050" />
        <week number="4" dvds_rented="11200" />		  
      </month>
      <month>
        <name>March 50</name>
        <week number="1" dvds_rented="11000" />
        <week number="2" dvds_rented="12390" />
        <week number="3" dvds_rented="10050" />
        <week number="4" dvds_rented="11200" />		  
      </month>
    </data>
  </sales>

People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Gateway Launches New Core i7-powered FX-Series Gaming PCs · Review: Lenovo ThinkPad SL300 · EBay, Alternative Site Holiday Resources for Sellers