spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column100


Web Services, Part V: XML and XSLT Programming

Interpreting XML

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

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

Next: How to convert XML to HTML

http://www.internet.com


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: December 31, 2001
Revised: December 31, 2001

URL: http://www.webreference.com/js/column100/3.html