JMRI: Intro to XML

# JMRI: DecoderPro User Guide

## Intro to XML

All of the JMRI configuration files use the XML format. This section is a brief explanation of that format to make it a little easier to understand.

### Elements and Tags

XML files are made up of "elements", which are delimited by "tags". It's a lot like HTML, if you're familiar with that. A tag is enclosed in angle brackets, for example <decoder>. An element can either begin and end with a tag:

<decoder>
other stuff here
</decoder>

or have both the start and end tags combined:

<decoder/>

Note the back-slash characters. They mark the end of the element. The starting tag of an element can also carry attributes:

<decoder name="foo">
other stuff here
</decoder>

This example shows the attribute "name" being set to a value of "foo". Some attributes are required, and some are optional. Note the double-quotes around the attribute value. They are required.

### Line Breaks and Indentation

Finally, a word about line-breaks and indentation. Tabs, spaces and line-breaks don't mean anything in XML files except within the double quotes of an attribute value. To make it easier to read the original file, we often use the indenting to show what elements are inside each other. Each time we start a new element, we indent its contents by another four spaces. An example would be:

<decoder>
<variable>
stuff in the 1st variable element
</variable>
<variable>
stuff in the 2nd variable element
</variable>
</decoder>

You can break the contents of an element across a line, if that makes it easier to read:

<tagWithLotsOfAttributes
firstAttribute="foo"
secondAttribute="bar"
thirdAttribute="biff"
fourthAttribute="bing" />