What is XML
Extensible Markup Language (XML) defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.
The following shows a sample XML document:
<?xml version="1.0" encoding="UTF-8"?>
<!-- A sample XML document -->
<nutrition>
<daily-values total=2000>
<total-fat units="g">65</total-fat>
<saturated-fat units="g">20</saturated-fat>
<cholesterol units="mg">300</cholesterol>
<sodium units="mg">2400</sodium>
<carb units="g">300</carb>
<fiber units="g">25</fiber>
<protein units="g">50</protein>
</daily-values>
<food>
<name>Avocado Dip</name>
<mfr>Sunnydale</mfr>
<serving units="g">29</serving>
<calories total="110" fat="100">
<total-fat>11</total-fat>
<saturated-fat>3</saturated-fat>
<cholesterol>5</cholesterol>
</food>
<food>
<name>Truffles, Dark Chocolate</name>
<mfr>Lyndon's</mfr>
<serving units="g">39</serving>
<calories total="220" fat="170"/>
<total-fat>19</total-fat>
<saturated-fat>14</saturated-fat>
<cholesterol>25</cholesterol>
</food>
</nutrition>This document consists of the <nutrition> tag followed by the <daily-values> and <food> elements. The elements contain other elements which can appear multiple times.
In general, an element contains attribute and text (value) content. For example:
<book category=fiction>Harry Potter<\book>
Here, fiction is the attribute and Harry Potter is the text content.
In order to take the content of a worksheet and produce an XML document, a relationship needs to be formed between the cell values on the worksheet and the XML elements of the document. This relationship needs to consider that elements can contain a set of sub elements.