84 lines
3.0 KiB
Plaintext
84 lines
3.0 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy for HTML5 for Apple macOS version 5.8.0">
|
|
<!-- Copyright Bob Jacobsen 2008 -->
|
|
|
|
<title>JMRI: Intro to XML</title><!--#include virtual="/help/en/parts/Style.shtml" -->
|
|
</head>
|
|
<body>
|
|
<!--#include virtual="/help/en/parts/Header.shtml" -->
|
|
|
|
<div id="mBody">
|
|
<!--#include virtual="Sidebar.shtml" -->
|
|
|
|
<div id="mainContent">
|
|
<!-- Page Body -->
|
|
|
|
<div class="list">
|
|
<h1>JMRI: DecoderPro User Guide</h1>
|
|
|
|
<h2>Intro to XML</h2>
|
|
|
|
<p>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.</p>
|
|
|
|
<h3>Elements and Tags</h3>
|
|
|
|
<p>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:</p>
|
|
|
|
<p class="example"><decoder><br>
|
|
other stuff here<br>
|
|
</decoder><br></p>
|
|
or have both the start and end tags combined:
|
|
<p class="example"><decoder/></p>
|
|
|
|
<p>Note the back-slash characters. They mark the end of the element. The starting tag of an
|
|
element can also carry attributes:</p>
|
|
|
|
<p class="example"><decoder name="foo"><br>
|
|
other stuff here<br>
|
|
</decoder><br></p>
|
|
|
|
<p>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.</p>
|
|
|
|
<h3>Line Breaks and Indentation</h3>
|
|
|
|
<p>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:</p>
|
|
|
|
<p class="example"><decoder><br>
|
|
<variable><br>
|
|
stuff in the 1st variable element<br>
|
|
</variable><br>
|
|
<variable><br>
|
|
stuff in the 2nd variable element<br>
|
|
</variable><br>
|
|
</decoder></p>
|
|
|
|
<p>You can break the contents of an element across a line, if that makes it easier to
|
|
read:</p>
|
|
|
|
<p class="example"><tagWithLotsOfAttributes<br>
|
|
firstAttribute="foo"<br>
|
|
secondAttribute="bar"<br>
|
|
thirdAttribute="biff"<br>
|
|
fourthAttribute="bing" /></p>
|
|
</div>
|
|
<!-- closes list -->
|
|
<!--#include virtual="/help/en/parts/Footer.shtml" -->
|
|
</div>
|
|
<!-- close #mainContent -->
|
|
</div>
|
|
<!-- close #mBody -->
|
|
<script src="/js/help.js"></script>
|
|
</body>
|
|
</html>
|