* Melchior FRANZ -- Saturday 28 July 2007:
> It was asked in the German fgfs forum[1] if it's possible
> to log internal data to an XML file. Sure is!  :-)

And now it's also possible to do via regular "generic" protocol.
Writing XML is a trivial thing (unlike reading&parsing), but the
"generic" protocol needed some enhancements to support it. There's
nothing XML specific built-in -- all elements are simple text. For
trying the attached simple protocol file put it into
$FG_ROOT/Protocols/ and call fgfs like so:

  $ fgfs --generic=file,out,1,/tmp/foo.xml,xmltest


The file is meant to be easy to understand, not to be as short
and efficient as possible. The following changes could be made:

- don't use the two tag chunks, but put the tags into the first
  and last data chunk's <format>
- use > instead of &gt;  (only < needs to be written as &lt;)
- don't use \n in every <format>, but use <{var,line}_separator>
  instead
- leave out the redundant <binary_mode>false</binary_mode>

Update to the two remaining README.protocol files will follow
later today.

m.
<?xml version="1.0"?>

<PropertyList>
	<generic>
		<output>
			<binary_mode>false</binary_mode>
			<line_separator></line_separator>
			<var_separator></var_separator>
			<preamble>&lt;?xml version="1.0"?&gt;\n\n&lt;data&gt;\n</preamble>
			<postamble>&lt;/data&gt;\n</postamble>

			<chunk>
				<format>\t&lt;set&gt;\n</format>
			</chunk>

			<chunk>
				<node>/position/altitude-ft</node>
				<type>float</type>
				<format>\t\t&lt;altitude-ft&gt;%.8f&lt;/altitude-ft&gt;\n</format>
			</chunk>

			<chunk>
				<node>/velocities/airspeed-kt</node>
				<type>float</type>
				<format>\t\t&lt;airspeed-kt&gt;%.8f&lt;/airspeed-kt&gt;\n</format>
			</chunk>

			<chunk>
				<format>\t&lt;/set&gt;\n</format>
			</chunk>
		</output>
	</generic>
</PropertyList>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to