*.xml FILES
*.xml
files are configuration files that end in "xml". You can find examples of these files in most packages, for example in an aircraft package you have the [model].xml
and for airports you can have the services.xml
.
You can find full details of the XML specification here, and as such we won't be covering all those details in this document. However for those of you who are new to Microsoft Flight Simulator and/or have little experience with XML we'll give a brief overview of how it works in relation to the sim and add-on content.
Also note that the file should be saved using a specific encoding as explained here:
XML Format
XML is similar to HTML in that it is a mark-up language that requires a parser to be processed and used. Unlike HTML, there are no predefined tags in XML and the format is primarily used for the transfer of data rather than for displaying data. The following list explains the core components of XML:
- Declaration: XML documents should start with a declaration of information about the document. The exact data you put in this declaration can vary, but if you are unsure what to use then the following is perfectly fine as the minimum required:
<?xml version="1.0" encoding="UTF-8"?>
- Tags : A tag is a markup construct that begins with
<
and ends with>
. Generally there will always be a start-tag (for example<description>
) and an end-tag (for example</description>
). Some tags may be self-closing, which means a single tag is both the opening and closing tag all in one, for example:<LibraryObject name="{830B4ADB-A72F-45F6-82C2-BF1F64FF81EE}" scale="1.425599"/>
- Elements: An element is the main XML component and begins with a start-tag and ends with a matching end-tag. What you put between the elements is the content which may contain text, numbers, mark-up, or even other elements (called sub-elements). Note that if an element uses a self-closing tag and you omit the
/
symbol, or try to use a closing tag, this will give an error. - Attributes: An attribute is something that is set within the start-tag as part of the element. It is "attributing" some data to the element using the
attribute = "value"
format. Note that the value must always be in quotes""
for an attribute. - Comments: Comments can be added to an XML document by encasing them in
<!--
and-->
.
Below you can see an actual example of the XML used in a Microsoft Flight Simulator file:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document Type="RTC_Challenge" version="1.0">
<WorldBase.Flight>
<!-- START Intro -->
<SimMission.RTCSequencer InstanceId="{F9B4BD6B-8E0B-434C-9876-D859069EDE0A}">
<Descr>RTC_Challenge</Descr>
<NeedPreload>True</NeedPreload>
<Shuffle>False</Shuffle>
<Actions>
<ObjectReference id="RTC_Airport_Overview" InstanceId="{347FAB01-05E1-432E-8A23-396052B7B77D}}"/>
<ObjectReference id="RTC_POI_Tower" InstanceId="{344EC464-2B26-4C8B-A6E9-6D89E8BDD609}"/>
<ObjectReference id="RTC_Aircraft_Intro" InstanceId="{7B45E0FC-F507-4AFB-99EE-53DBE8291374}"/>
</Actions>
</SimMission.RTCSequencer>
<!-- END Intro -->
</WorldBase.Flight>
</SimBase.Document>
The XML files that are created using the various editors will be used to tell the simulation details about how something works, it's place in the world, how it should be animated, and many other details. Sometimes you'll also need to edit (or create) these files by hand as not all the information they need to contain can be accessed using the Developer mode tools.