STRaND-1 Decoded Telemetry Data

bin2xml is an attempt at a completely generic, configureable file parser, mainly aimed at binary input data. It uses an XML definition file to attempt to decode an input file into "packets", then wraps those up in XML structures for output. Optionally, it can use an XSL stylesheet to transform the XML before it gets output. By default, a generic "default.xsl" and "default.css" style combination will be used, which generates the red tables shown on this page.

The definition file contains one or more "templates", which define the data layout for a type of data packet. bin2xml will try each one of these templates in turn (in the order they appear in the template file), and if one of the templates matches, then the data will be parsed into it. A populated XML structure is then generated, which is the same as the template used, but fully populated with the input data. The format for the template file is described in full in writing_templates.txt.

bin2xml is written in Python, so it isn't going to break any records for sheer speed, however the advantage is it was easy to write (taking a few days) and is incredibly flexible.

./bin2xml.py -h usage: Process the binary input file according to the packet formats defined in the XML file [-h] [-i input_file] [-o output_file] [-s stylesheet] [-v] [-d] [-t --transform] template positional arguments: template the XML format file to use optional arguments: -h, --help show this help message and exit -i input_file the binary file to process -o output_file XML file to write parsed data to -s stylesheet XSL stylesheet to use for the output -v Increase output -d Debug -t --transform Perform an XSLT transform on the data before outputting

I think the functionality is best demonstrated by example, so the remainder of this page is devoted to usage and output examples. The code is available from the navigation bar on the left.

Broadly speaking, a bin2xml command will look something like this:

./bin2xml.py format_file.xml -i binary_data.log -t -o pretty_output.html