On 09/23/2012 06:28 PM, Curtis Olson wrote:
> I have a question about the Flightgear xml config system and doing
> "includes".  This is an arbitrary example, but let's say I have an xml
> config file called "main.xml":
>
> <PropertyList>
>    <config>
>      <weight-and-balance include="passengers.xml" />
>    </config>
> </PropertyList>
>
> The passenger.xml file might look like the following:
>
> <PropertyList>
>    <passenger1-kg>60</passenger1-kg>
>    <passenger2-kg>60</passenger2-kg>
>    <passenger2-kg>60</passenger2-kg>
>    <passenger2-kg>60</passenger2-kg>
> </PropertyList>
>
> In the property tree after this loads I will have:
>
> /config/weight-and-balance/passenger1-kg = 60
> /config/weight-and-balance/passenger2-kg = 60
> /config/weight-and-balance/passenger3-kg = 60
> /config/weight-and-balance/passenger4-kg = 60
>
> Now this is an arbitrary example, but what I want to do in my main.xml
> is override some of the default values in passenger.xml.  Just imagine I
> am including a much more complicated config file with a lot of standard
> values, but maybe I want to override a tcp port, or set a enable/disable
> flag and do that from the main.xml level, and not touch the included
> file.  This included file may get included on a number of systems and I
> may want to set specific values for each installation, rather than
> create a myriad of slightly different copies of a bunch of different
> included files.

As far as I know XML is processed in order of appearance, so this should 
do the trick:

<PropertyList>
   <config>
     <weight-and-balance include="passengers.xml">

       <passenger1-kg>75</passenger1-kg>
       <passenger3-kg>80</passenger1-kg>

     </weight-and-balance>
   </config>
</PropertyList>


Erik

-- 
http://www.adalin.com - Hardware accelerated AeonWave and OpenAL
                         for Windows and Linux

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to