Pipes

ToXML | XSLT | XPath | XMLToFlat | Zip | Unzip | FOP | Excel | XPathMetadata

 

 

This pipe transforms any delimited (like csv) or fixed length flat file into XML.
Here's what it looks like in the config file :

<pipe name="transform_to_XML1" type="ToXML" msgKind="delimited" delimiter=";" rootTag="XMLFile" recTag="XMLRec" encoding="UTF-8">
++++++<field name="message" length="10" />
++++++<field name="date1" length="6"/>
++++++<field name="ident" length="12"/>
++++++<field name="account_no" length="8"/>
++++++<field name="skybill_no" length="11"/>
++++++<field name="date_sb" length="10"/>
++++++<field name="status" length="1"/>
</pipe>

The "field" tags permits to describe the input files and name the tags of the output XML file. Length is used only in case of a fixed length flat file. Note : the attributes is needed even if the file is a delimited one (leave the value empty then...).

Parameters :

type toXML
msgKind delimited or fixedLength
delimiter

Needed even if the file is a fixed length

rootTag Name of the root element of the XML output file
recTag Name of the record Tags of the XML output file (tag that embraces the fields tags)
encoding encoding of the XML output file

 

For the config example given above, we get an XML output that looks like this :

<?xml version="1.0" encoding="UTF-8">
<XMLFile>
++++++<XMLRec>
++++++ ++++++<message>dcdcd</message>
++++++ ++++++<date1>2003-08-05</date1>
++++++ ++++++<ident>1212</ident>
++++++ ++++++<account_no>11223</account_no>
++++++ ++++++<skybill_no>532434</skybill_no>
++++++ ++++++<date_sb>2003-08-08</date_sb>
++++++ ++++++<status>B</status>
++++++</XMLRec>
++++++<XMLRec>
++++++ ++++++<message>dcdcd</message>
++++++ ++++++<date1>2003-08-05</date1>
++++++ ++++++<ident>1212</ident>
++++++ ++++++<account_no>11223</account_no>
++++++ ++++++<skybill_no>532434</skybill_no>
++++++ ++++++<date_sb>2003-08-08</date_sb>
++++++ ++++++<status>B</status>
++++++</XMLRec>
++++++<XMLRec>
++++++...
++++++...
</XMLFile>

 

 

This pipe applies an XSLT Stylesheet on the input message (which, of course is an XML file...).
The XSLT parser I use is Saxon from Michael Kay.

Parameters :

type XSLT
stylesheet URL of stylesheet (can be on the local file system. Ex : c:\\XSL\\style.xsl)

 

 

This pipe outputs the result of an XPath statement given in parameters.

Parameters :

type XSLT
xpath XPath statement to process on the input message
rootTag Root tag of the output XML file
encoding Encoding of the output file

 

 

This pipe converts the input XML message to a flat file (delimited or fixed length).
The input XML message must look like the output of the toXML pipe :

<?xml version="1.0" encoding="UTF-8">
<XMLFile>
++++++<XMLRec>
++++++ ++++++<message>dcdcd</message>
++++++ ++++++<date1>2003-08-05</date1>
++++++ ++++++<ident>1212</ident>
++++++ ++++++<account_no>11223</account_no>
++++++ ++++++<skybill_no>532434</skybill_no>
++++++ ++++++<date_sb>2003-08-08</date_sb>
++++++ ++++++<status>B</status>
++++++</XMLRec>
++++++<XMLRec>
++++++ ++++++<message>dcdcd</message>
++++++ ++++++<date1>2003-08-05</date1>
++++++ ++++++<ident>1212</ident>
++++++ ++++++<account_no>11223</account_no>
++++++ ++++++<skybill_no>532434</skybill_no>
++++++ ++++++<date_sb>2003-08-08</date_sb>
++++++ ++++++<status>B</status>
++++++</XMLRec>
++++++<XMLRec>
++++++...
++++++...
</XMLFile>

Parameters :

type XMLToFlat
msgKind delimited or fixedLength
delimiter Character used to separate fields in the output file, if msgKind is delimited

 

If you choose fixedLength as output message kind, you need to provide fields length. This is done in the config file as in the ToXML Pipe :

<pipe name="transform_to_Flat" type="XMLToFlat" msgKind="fixedLength" delimiter="">
++++++<field name="message" length="10" />
++++++<field name="date1" length="6"/>
++++++<field name="ident" length="12"/>
++++++<field name="account_no" length="8"/>
++++++<field name="skybill_no" length="11"/>
++++++<field name="date_sb" length="10"/>
++++++<field name="status" length="1"/>
</pipe>

 

This pipe compresses the incoming message using the zlib.

Parameters :

type Zip
fileName Name of the file compressed into zip (can be left empty)

 

This pipe decompresses a zip incoming message.

Parameters :

type Unzip

 

 

 

 

This pipe uses Apache's FOP to produce PDF or PS files. It takes XSL-FO files as input.

type Fop
format PS or PDF

 

 

This pipe uses Apache's Cocoon and Jakarta POI to produce MS Excel files. It takes Gnumeric-xml files as input.

type Excel

 

 

The XPath Metadata pipe permits to extract some data from the message into the metadata dictionary, using XPath queries.
(If you don't know what metadatas are in Retic, please check this page)

type XPathMetadata

 

You can extract several metadatas at once. To specify their name and XPath, use <params> and <param> tags :

<pipe name="XPathMetadata22" type="XPathMetadata">
+++<params name="params20" type="params">
+++ +++<param name="dateEvt" type="param" paramType="" value="/abonnement/evt/date_evt"/>
+++
+++<param name="libelleEvt" type="param" paramType="" value="/abonnement/evt/libelle"/>
+++
+++<param name="numeroLt" type="param" paramType="" value="/abonnement/evt/no_lt"/>
+++</params>

Here are extracted three metadatas, called respectively dateEvt, libelleEvt and numeroLt.

As you can see, the XPath statement is set in the value attribute of the param tag.
In Retic Administrator, you have specific buttons to add <params> and <param> tags (By the way, they have nothing to do with parameters files).