Previous topic

Runtime Settings

XML Syntax Primer

Here a quick refresher on what valid XML looks like in general. Please note that this is not a full specification of XML, just a quick informal overview.

First here is some example XML which contains all major elements:

  <!-- This is a comment -->
  <child id="first" attr="val">data</child>
  <child id="second">
  <child id="empty"/>
  <child id="escapes">
     These are in the same order as the ones in the CDATA
     section below: &lt;, &gt;, &amp;, &quot;
  <child id="cdata"><![CDATA[
     Unparsed data, can include <, >, &, " but not]]> ]]>
      This is also a comment

Basically XML consists of tags or elements (these two terms are often used interchangeably) which have attributes and data in them. Let’s go through a whirlwind tour of this example.

This is the fist tag in this document, called the root element, with an element name of “root”. XML specifies that there must be one and exactly exactly one root element, the name of which doesn’t matter.
<!-- Comment -->
Comments may appear anywhere in a document outside other markup. They are not part of the XML document’s character data but an XML processor may make it possible for an application to retrieve the text of comments. The string -- (double-hyphen) must not occur within comments.
<child id="first">

The first child tag, this element has an attribute called id which is set to the value “first”, a second attribute attr has the value val. Inside it is “data” which can be any text, XML itself doesn’t care as long as it does not contain any special characters.

Note that XML actually treats the id attribute special, it’s value should be a unique from all other id values in the document. XML also reserves any attribute starting with xml: as special, so avoid using those.

<child id="second>
This is another child, it shows that any element can have nested children, as many as you like.
<child id="empty"/>

An element with no data can also be written like this. This is semantically the same as:

<child id="empty"></child>
<child id="escapes">
As you may have noticed already XML treats some characters as special, they are: < > & ". If you want to use these characters you must escape them with the sequences shown. Notice that " can be used freely in element data, the escaped version is only needed when it must be used as an attribute value.
<child id="cdata">

When storing data inside an element it can be cumbersome if it contains lots of characters that must be escaped. In this case you can use Unparsed Character Data instead of the default Parsed Character Data. This is done by enclosing the data between <![CDATA[ and ]]>.

To clarify, the actual data contained in this element (stripped from leading and trailing whitespace which is actually significant in XML) is:

Unparsed data, can include <, >, &, " but not ]]>

This introduction to XML is adequate in order to understand the configuration. If you would like to know more about XML the World Wide Web Consortium publishes the standard at (version 1.0) and (version 1.1).