Striim 3.10.3 documentation

XML Formatter

Formats a writer's output as XML.

property

type

default value

notes

Charset

String

Element Tuple

String

defines the XML output

Format Column Value As

String

xmlattribute

If the target's input is the output of an Oracle Reader source that will emit VARRAY data, set to xmlelement (see Oracle Reader data type support and correspondence).

Root Element

String

Row Delimiter

String

\n

see Setting rowdelimiter values

For example, this variation on the PosApp sample application writes to a file using XMLFormatter:

CREATE source XMLFormatterTestSource USING FileReader (
  directory:'Samples/PosApp/appData',
  wildcard:'PosDataPreview.csv',
  blocksize: 10240,
  positionByEOF:false
)
PARSE USING DSVParser (
  header:Yes,
  trimquote:false
) OUTPUT TO XMLSource_Stream;

CREATE CQ CsvToPosData
INSERT INTO XMLTransformed_Stream
SELECT TO_STRING(data[0]),
  TO_STRING(data[1]),
  TO_DATEF(data[4],'yyyyMMddHHmmss'),
  DHOURS(TO_DATEF(data[4],'yyyyMMddHHmmss')),
  TO_DOUBLE(data[7]),
  TO_STRING(data[9])
FROM XMLSource_Stream;

CREATE TARGET XMLFormatterOut using FileWriter(
  filename:'XMLFormatterOutput')
FORMAT USING XMLFormatter (
  rootelement:'document',
  elementtuple:'MerchantName:merchantid:text=merchantname'
)
INPUT FROM XMLTransformed_Stream; 

The first lines of XMLFormatterOutput are:

<?xml version="1.0" encoding="UTF-8"?>
<document>
 <MerchantName merchantid="D6RJPwyuLXoLqQRQcOcouJ26KGxJSf6hgbu" > COMPANY 1 </MerchantName>
 <MerchantName merchantid="OFp6pKTMg26n1iiFY00M9uSqh9ZfMxMBRf1" > COMPANY 2 </MerchantName>
 <MerchantName merchantid="ljh71ujKshzWNfXMdQyN8O7vaNHlmPCCnAx" > COMPANY 3 </MerchantName>