What is XML?

XML

XML stands for eXtensible Mark-up Language. XML is a simple, flexible text-based format. XML standards are developed by the World Wide Web Consortium (W3C) . See http://www.w3.org/XML/.

Mark-up language

A mark-up language is a standardised and structured method of creating a text file that contains information intended for consumption and processing by computers. While documents written in mark-up languages can be read by people, they are primarily read by machines and not well suited for human reading.

Although, in a table such as that below, the relationship between cells (how row 1 cell 1 relates to row 2 cell 1) might be discernible to the human reader, there is no intrinsic connection between the contents that can be reliably interpreted by a machine (computer).

Data and time Water level
2009-06-06 12:00:00 1.234

By comparison, XML delivery of information within xml field-tags implies a relationship between content. This relationship is machine readable.  For instance:

 <?xml version="1.0"?>
<wdtf:HydroCollection>
<wdtf:TimeSeries>
<wdtf:timeValuePair time="2009-06-06T12:00:00+10:00">1.234</wdtf:timeValuePair>
</wdtf:TimeSeries>
</wdtf:HydroCollection>

In the above example it is possible to unambiguously know that the ‘time’ field’s content (2009-06-06T12:00:00+10:00) is a part of a timeValuePair, and has a related ‘value’ of ‘1.234’.  The structure gives context to the relationship between the fields, and typically there are predefined definitions for each field tag (such as ‘time’).
The eXtensible Mark-up Language is used for delivering data in a predictable structure (defined by a schema).

XML does not contain formatting or display instructions, but eases the process of writing programs to customise the display of the content, to fit a range of display needs.

Why define an XML format.

Pre-defined formats ensure that data, expressed consistently, can be passed between organisations without a loss of meaning.

XML provides a consistent way to define an expected structure, such as which field tags are allowable, and in which order, for the transmission of data. It also enables (via a schema) a standard way to express the number of times that a field can or must be expressed, and so on. It also provides a standardised way to define re-use of parts of other pre-defined xml formats. This provides the opportunity for interoperability across broader communities.

The XML fragment below builds on the previous minimal example by adding, to the file header,  references to standards schemas and format schemas that are being used to define the structure and meaning of the XML data document.

 <?xml version="1.0"?>
<wdtf:HydroCollection
xmlns:sa="http://www.opengis.net/sampling/1.0/sf1"
xmlns:om="http://www.opengis.net/om/1.0/sf1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gml="http://www.opengis.net/gml"
xmlns:wdtf="http://www.bom.gov.au/std/water/xml/wdtf0.3"
xmlns:ahgf="http://www.bom.gov.au/std/water/xml/ahgf0.1"
xsi:schemaLocation="http://www.opengis.net/sampling/1.0/sf1 ../sampling/sampling.xsd
http://www.bom.gov.au/std/water/xml/wdtf0.3 ../wdtf/water.xsd
http://www.bom.gov.au/std/water/xml/ahgf0.1 ../ahgf/waterFeatures.xsd">
<wdtf:TimeSeries>
<wdtf:timeValuePair time="2009-06-06T12:00:00+10:00">1.234</wdtf:timeValuePair>
</wdtf:TimeSeries>
</wdtf:HydroCollection>

The inclusion of ‘xmlns:xlink=http://www.w3.org/1999/xlink’ means that when, in this format, an xlink is used, it will follow the approach recommended by http://www.w3.org/1999/xlink.

Inclusion of these references means that the field tags and data can be read unambiguously, based on various standardised ‘declarations’ on format, re-use, and so on.

Online resources

The internet is full of XML related information, a few valuable references include:

World wide web consortium (W3C)
http://www.w3.org/XML/
http://www.w3.org/
W3 Schools - not related to W3C
http://www.w3schools.com/
http://www.w3schools.com/xml/default.asp
Open geospatial consortium (OGC)
http://www.opengeospatial.org/
OGC - Observations and Measurements standard
http://www.opengeospatial.org/standards/om

Creative Commons By Attribution logo
Unless otherwise noted, all material on this page is licensed under the Creative Commons Attribution Australia Licence