XML

Synopsis

HELP:   Format elements (tags, attributes, data, ...) as XML data stream
TYPE:   OBJECT
SYNTAX: XML(METHOD.{})

Description

The object "format XML" creates a valid XML document from FLAM elements, resulting in UTF-8 data block with character data.

The output XML can be formatted using 4 different methods:

The XML output is written in blocks and encoded in UTF-8 with line feed (0xA) as line delimiter unless a CCSID is supplied, in which case character conversion is performed.

The PRETTYPRINT and MINIMIZED methods have two parameters that allow control of how to deal with whitespace in input data. In order to decide whether whitespace in the input may be dropped or not, it needs to be cached until the next non-whitespace characters occur. By default, up to 4096 consecutive whitespace characters can be cached. You can increase this number if your documents may contain more consecutive whitespace. You can also specify what to do if the cache runs full. The cached whitespace can either be written to output, possibly resulting in less nicely formatted XML, or processing can be aborted with an error.

An XML document created by the DUMP method has a root tag <flam>. It contains one <configuration> and one or more <elementList> blocks. The <configuration> section reflects the options used to create the FLAM elements dump. The <elementList> contains one <element> tag for each FLAM element in the input data in the order of input. It may have up to three optional attributes (type, attr, hash). The element's data is written to the tag's body. The data formats of the data as well as of the attributes attr and hash are the ones defined in the <configuration> section. Here is a simple example of two FLAM elements dumped to XML with data in hexadecimal format:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<flam>
  <configuration>
    <dumpFormat>
      <data>HEX</data>
      <attr>HEX</attr>
      <hash>HEX</hash>
    </dumpFormat>
  </configuration>
  <elementList>
    <element type="2">01234567890</element>
    <element type="18">0A</element>
  </elementList>
</flam>

XML formatting supports a lot of powerful features which can be accessed with the parameters below.