PropertyList XML files: Difference between revisions

Jump to navigation Jump to search
m
More cleanup
m (Cleanup)
m (More cleanup)
Line 31: Line 31:
</syntaxhighlight>
</syntaxhighlight>


Property typing is optional, all properties are by default string/unspecified and are transparently converted by the property tree, but it never hurts, especially when including spaces around numbees:
Each node in a tree is specified using a single tag that can take attributes describing various things about it:
 
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
  <welcome type="string">Welcome to FlightGear! This is a string as a property</welcome>
</PropertyList>
</syntaxhighlight>
 
Property typing is optional, all properties are by default string/unspecified and are transparently converted by the property tree, but it never hurts, especially when including spaces around numbers:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 53: Line 62:
</syntaxhighlight>
</syntaxhighlight>


so that the three foo tags become foo[0], foo[1], foo[2] in the property tree.
so that the three foo tags become foo[0], foo[1], foo[2] in the property tree, but you can also use explicit indexing by setting the '''n''' attribute of each tag:
 
 
You can also use explicit indexing by setting the '''n''' attribute of each tag:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
Line 67: Line 73:
</syntaxhighlight>
</syntaxhighlight>


Multiple children with the same name are automatically numbered sequentially when there is no "n" attribute, so the above is synonymous with
Though the above two examples are equivalent, we tend often to include "n" anyway, just to help people keep track of where they are.  That's most important when there are a lot of subproperties, not in a simple list like the above.
 
<syntaxhighlight lang="xml">
  <sim>
  <foo n="0">A</foo>
  <foo n="1">B</foo>
  </sim>
</syntaxhighlight>
 
We tend often to include "n" anyway, just to help people keep track of where they are.  That's most important when there are a lot of subproperties, not in a simple list like the above.


To make property settings persistent in between FlightGear sessions, use the userarchive attribute:
To make property settings persistent in between FlightGear sessions, use the userarchive attribute:
Line 88: Line 85:




We can also create new *-set.xml files by subtyping existing ones. For example, if someone made a DC-3 model for JSBSim, we could subclass from the YASim config file like this:
We can also create new PropertyList files by subtyping existing ones using the include attribute. For example, if someone made a DC-3 model for JSBSim, we could subclass from the YASim config file like this:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
395

edits

Navigation menu