Howto:Create animation XML files from Nasal

From FlightGear wiki
Revision as of 13:35, 5 February 2012 by Hooray (talk | contribs) (Created page with "{{Stub}} Objective: Use Nasal scripting to dynamically create an XML file by using the setprop() API call to set up your XML file's PropertyList-encoded structure and then w...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

Objective: Use Nasal scripting to dynamically create an XML file by using the setprop() API call to set up your XML file's PropertyList-encoded structure and then writing the result to the file system using the write_properties() wrapper.


Getting started

The following piece of Nasal creates a new XML file:

 var location= "/temp/test/foo";
 var filename="test.xml";
 setprop(location, "hello world");
 write_properties(filename, location);


The created output is:

 <?xml version="1.0"?>
 <PropertyList>
  <temp>
   <test>
    <foo>hello world</foo>
   </test>
  </temp>

Related