Postfinance XML file format changes - upgrade of the xml2doc script

Emin Gabrielyan

2009-11-05

Postfinance XML file format changes - upgrade of the xml2doc script 1

Download. 1

Changes in the XML format of postfinance statements. 2

The definition of the XML flow.. 2

The new XML format with samples. 10

BEGIN XML Flow.. 11

Opening balance. 13

Credit 14

Red slip credit 15

Debit 17

Debit LNS. 19

Totals. 20

Closing balance. 21

END XML Flow.. 22

References. 22

Related links at postfinance. 22

References to the message formats. 23

References to other developers. 25

Perl links. 25

Required packages. 25

This tool permits conversion of XML files of Postfinance statements into MS-Word DOC files with the images of red payment slips alongside with electronic data.

Download

New version of postfinance xml2doc script is available since 2009-11-05. All further versions will be released in the code depository:

[Code Depository]

[Download xml2doc]

Refer to the original page for usage manual:

User manual [090302 ii]

Changes in the XML format of postfinance statements

The format change of postfinance XML files occurred on 2009-10-12. In the new format the SG6 element can contain additional two sub-elements (PF:TGT and PF:EPC).

$ grep -i "element sg6" *.txt

091008-acc_200.dtd.txt:<!ELEMENT SG6 (RFF*, DTM*, MOA, FTX*)>

091009-acc_200.dtd.txt:<!ELEMENT SG6 (RFF*, DTM*, MOA, FTX*)>

091012-acc_200.dtd.txt:<!ELEMENT SG6 (PF:TGT*, RFF*, DTM*, MOA, PF:EPC*, FTX*)>

091013-acc_200.dtd.txt:<!ELEMENT SG6 (PF:TGT*, RFF*, DTM*, MOA, PF:EPC*, FTX*)>

091014-acc_200.dtd.txt:<!ELEMENT SG6 (PF:TGT*, RFF*, DTM*, MOA, PF:EPC*, FTX*)>

091031-acc_200.dtd.txt:<!ELEMENT SG6 (PF:TGT*, RFF*, DTM*, MOA, PF:EPC*, FTX*)>

The Document Type Definition (DTD) files of 8th, 9th, 12th, 13th, 14th, and 31st October are provided for a reference. You can check also the output of diff on these files.

The definition of the XML flow

The full code of the first version of the Perl script is published in details [090302 ii]. In this section we present only pattern definitions of XML elements. Only this part is modified in the new release. You can consult also the difference between the two releases.

The XML elements are recognized in the flow with Perl regular expressions. The regex patterns of complex elements are created incrementally by defining first patterns of simple elements and using them further for forming more complex patterns.

Code

Description

$s="\\s*";

Definition of a zero or more space separation pattern

$bra="(?:>|\\s+[^>]*>)";

Closing angle bracket of an opening XML tag represents also optional parameters within the opening tag

$ins="[^<]*";

Pattern inside an XML element, between opening and closing tags, without other embedded XML elements

$tag="<[^>]*>$ins</[^>]*>";

Any XML element without embedded sub element with opening and closing tags

$sign="<PF:D_5003$bra([+-])</PF:D_5003>";

The element PF:D_5003 is used for storing the sign (“+” or “-") of monetary values. The sign value is stored in the Perl pattern memory variable.

$lin="<LIN>$s<PF:D_0805\\s[^>]*Value=\"(\\w+)\">$s</PF:D_0805>$s</LIN>";

This is a pattern of the first sub element of the statement entry element SG4. The value seized by this pattern permits us to recognize the type of the entry.

If the value is equal to “LST” then the entry represents an opening balance.

If the value is equal to “LNE” then the entry is a credit, red payment slip credit, or a debit.

If the value is equal to “LNS” then this is a direct debit.

If the value of this tag is equal to “LTI” then we are dealing with a entry displaying the totals (credits and debits) of the statement document.

If the value is equal to “LEN” then it is a closing balance entry.

$moa="<MOA>$s<C516>$s<D_5025 Value=\"(\\d+)\"></D_5025>$s<D_5004>([\\d\\.]+)</D_5004>$s</C516>$s$sign$s</MOA>";

MOA element stores monetary amounts with a type attribute and the sign. Therefore, three values are seized.

The same MOA element is used both in SG5 element (for the current balance) and in SG6 element (for the transaction/movement amount).

If D_5025 value is equal to “315” then we are dealing with the opening balance (MOA element is in SG5).

If D_5025 value is equal to “210” then we are dealing with a credited amount of an entry for an electronic credit, red slip credit or for totals. If its value is “211” then it is a debit (simple or direct) or a sum of debits in the entry for totals. In these cases MOA is in SG6 element.

The value of D_5025 is equal to “15” for all balance updates in movement/transaction entries (credit, red slip credit, debit, and direct debit). The MOA is in SG5 (balance) element of the entry (and not in SG6).

The value of D_5025 for a closing balance amount is equal to “343”.

$dtm="<DTM>$s<C507>$s$tag$s<D_2380>(\\d+)</D_2380>$s</C507>$s</DTM>";

The DTM element stores the date and accompanies the both types of monetary amounts, the one representing the balance (in SG5) and the one representing a transaction (in SG6).

$ftx="<FTX>$s$tag$s$tag$s<C108>$s((?:<D_4440>$ins</D_4440>$s)+)</C108>$s</FTX>";

With the pattern for FTX element we seize the free texts (i.e. payment reasons) accompanying transactions.

$rff="<RFF>$s<C506>$s<D_1153 Value=\"(\\w+)\"></D_1153>$s<D_1154>(\\d+)</D_1154>$s</C506>$s</RFF>";

RFF element appears in SG6 element and helps us to identify the red payment slips and seize the image reference of the scanned red payment slip.

#<!ELEMENT SG5 (MOA?, DTM?)>

$sg5="<SG5>$s$moa$s$dtm$s</SG5>";

Constructing the pattern of SG5 element (balance dates and monetary values)

# On 2009-10-12 Postfinance changed the format of SG6 element by adding two sub-elements PF:TGT and PF:EPC

# OLD <!ELEMENT SG6 (RFF*, DTM*, MOA, FTX*)>

# NEW <!ELEMENT SG6 (PF:TGT*, RFF*, DTM*, MOA, PF:EPC*, FTX*)>

# NEW <!ELEMENT PF:TGT (PF:D_4752, PF:D_4753, PF:D_4754?)>

# NEW <!ELEMENT PF:EPC (PF:D_4752, PF:D_4753, PF:D_4754?)>

$pfins="(?:<PF:D_4752$bra$ins</PF:D_4752>)$s(?:<PF:D_4753$bra$ins</PF:D_4753>)$s(?:<PF:D_4754$bra$ins</PF:D_4754>)?";

$pftgt="<PF:TGT$bra$s$pfins$s</PF:TGT>";

$pfepc="<PF:EPC$bra$s$pfins$s</PF:EPC>";

Here we define the patterns of new elements PF:TGT and PF:EPC used in the SG6 element according to the new format of postfinance.

# OLD <!ELEMENT SG6 (RFF*, DTM*, MOA, FTX*)>

# OLD $sg6="$s(?:$rff$s)*(?:$dtm$s)?$moa$s(?:$ftx$s)?</SG6>";

#<!ELEMENT SG6 (PF:TGT*, RFF*, DTM*, MOA, PF:EPC*, FTX*)>

$sg6="$s(?:$pftgt$s)?(?:$rff$s)*(?:$dtm$s)?$moa$s(?:$pfepc$s)?(?:$ftx$s)?</SG6>";

Constructing the pattern of the SG6 element. The opening tag “<SG6>” is missing in the patter, because we use this construct as a separator when splitting a flow of consecutive SG6 elements into an array.

#<!ELEMENT SG4 (LIN, FTX*, SG5?, SG6*)>

$sg4="$s$lin$s(?:$ftx$s)?(?:$sg5$s)?(?:<SG6>$sg6$s)*</SG4>";

Defining the most complex pattern used in the script, that of the SG4 element (representing all statement entries). The opening tag “<SG4>” is missing (similarly to the pattern of SG6 element) because this construct is used as a split separator.

The new XML format with samples

The examples below are samples of different types of frequently used entries within an XML file of Postfinance statements. Statement entries are represented by SG4 elements. All samples are taken from an individual daily XML file with an exception of two debit samples taken and inserted from a monthly XML file. In the samples all sensible items (e.g. customer related data) are replaced by sequences of “X” signs. The following seven samples are presented:

Opening balance

Credit entry

Red payment slip credit

Debit

Direct debit

Entry of totals

Closing balance

On 2009-10-12 postfinance introduced two new elements PF:TGT and PF:EPC. These elements are used in SG6 sub-element of SG4 entries. The SG6 element is responsible for representing transaction/movement related data, i.e. amounts, signs, types (credit or debit), dates of movements, but not the balances (represented by SG5 sub-element). Each transactional entry has an SG6 element describing the movement and an SG5 element describing the balance after the movement. In the samples below the new elements introduced by Postfinance are highlighted in yellow.

BEGIN XML Flow

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE IC SYSTEM "acc_200.dtd">

<?xml-stylesheet type="text/xsl" href="acc_200.xsl"?>

<IC xmlns:PF="http://www.post.ch/xml">

<IC_HEADER>

<ICHDR>17-133617-0 Extrait de compte 14.10.2009</ICHDR>

<ICPFORM>H</ICPFORM>

<ICVVNR>2.12.0.2</ICVVNR>

<ICVVTXT>http://www.postfinance.ch/download</ICVVTXT>

</IC_HEADER>

<KONAUS>

<BGM>

<PF:D_0037 xmlns:PF="http://www.post.ch/xml">1</PF:D_0037>

</BGM>

<DTM>

<C507>

<D_2005 Value="202"></D_2005>

<D_2380 Desc="Date">

20091014

</D_2380>

</C507>

</DTM>

<DTM>

<C507>

<D_2005 Value="194"></D_2005>

<D_2380 Desc="Extrait de compte">

20091014

</D_2380>

</C507>

</DTM>

<SG2>

<FII>

<C078>

<D_3194 Desc="Numéro de compte">171336170</D_3194>

<D_3192 Desc="IBAN">CH39 0900 0000 1713 3617 0</D_3192>

<D_3193 Desc="BIC">POFICHBEXXX</D_3193>

<D_6345 Value="CHF"></D_6345>

</C078>

<PF:D_5388 xmlns:PF="http://www.post.ch/xml">

Compte commercial

</PF:D_5388>

</FII>

</SG2>

<SG3>

<NAD>

<D_3035 Value="HN"></D_3035>

<C058>

<D_3124 Desc="PostFinance Operations Center">Operations Center</D_3124>

<D_3124>1631 Bulle</D_3124>

<D_3124 Desc="Vous êtes conseillé par">Olivier Perret et team</D_3124>

</C058>

</NAD>

<COM>

<C076>

<D_3148 Desc="Téléphone">021 886 76 93</D_3148>

<D_3155 Value="TE"></D_3155>

</C076>

</COM>

<COM>

<C076>

<D_3148 Desc="Fax">058 667 66 08</D_3148>

<D_3155 Value="FX"></D_3155>

</C076>

</COM>

<COM>

<C076>

<D_3148 Desc="Saldophone">0848 221 221 (tarif normal)</D_3148>

<D_3155 Value="SA"></D_3155>

</C076>

</COM>

<COM>

<C076>

<D_3148 Desc="Internet">www.postfinance.ch</D_3148>

<D_3155 Value="IN"></D_3155>

</C076>

</COM>

</SG3>

<SG3>

<NAD>

<D_3035 Value="HQ"></D_3035>

<C058>

<D_3124>SWITZERNET Sàrl</D_3124>

<D_3124>Ecublens VD</D_3124>

</C058>

</NAD>

</SG3>

<SG3>

<NAD>

<D_3035 Value="HL"></D_3035>

<C058>

<D_3124>SWITZERNET Sàrl</D_3124>

<D_3124>PSE Bâtiment A  EPFL</D_3124>

<D_3124>1015 Lausanne</D_3124>

</C058>

</NAD>

</SG3>

<PF:FTX xmlns:PF="http://www.post.ch/xml">

<D_4451 Value="AAI"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>

PostFinance, un partenaire compétent pour les paiements à l&apos;étranger. Avec le</D_4440><D_4440>bon produit même quand c&apos;est urgent: Giro international urgent ou Western Union.

</D_4440>

</C108>

</PF:FTX>

<PF:FTX xmlns:PF="http://www.post.ch/xml">

<D_4451 Value="T26"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>Date</D_4440>

</C108>

</PF:FTX>

<PF:FTX xmlns:PF="http://www.post.ch/xml">

<D_4451 Value="T27"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>Texte</D_4440>

</C108>

</PF:FTX>

<PF:FTX xmlns:PF="http://www.post.ch/xml">

<D_4451 Value="T28"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>Crédit</D_4440>

</C108>

</PF:FTX>

<PF:FTX xmlns:PF="http://www.post.ch/xml">

<D_4451 Value="T29"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>Débit</D_4440>

</C108>

</PF:FTX>

<PF:FTX xmlns:PF="http://www.post.ch/xml">

<D_4451 Value="T30"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>Valeur</D_4440>

</C108>

</PF:FTX>

<PF:FTX xmlns:PF="http://www.post.ch/xml">

<D_4451 Value="T31"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>Solde</D_4440>

</C108>

</PF:FTX>

Opening balance

<SG4>

<LIN>

<PF:D_0805 xmlns:PF="http://www.post.ch/xml" Value="LST">

</PF:D_0805>

</LIN>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>ÉTAT DE COMPTE</D_4440>

</C108>

</FTX>

<SG5>

<MOA>

<C516>

<D_5025 Value="315"></D_5025>

<D_5004>15680.04</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<DTM>

<C507>

<D_2005 Value="202"></D_2005>

<D_2380>20091013</D_2380>

</C507>

</DTM>

</SG5>

</SG4>

Credit

<SG4>

<LIN>

<PF:D_0805 xmlns:PF="http://www.post.ch/xml" Value="LNE">

</PF:D_0805>

</LIN>

<SG5>

<MOA>

<C516>

<D_5025 Value="15"></D_5025>

<D_5004>15700.04</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">+</PF:D_5003>

</MOA>

<DTM>

<C507>

<D_2005 Value="202"></D_2005>

<D_2380>20091013</D_2380>

</C507>

</DTM>

</SG5>

<SG6>

<PF:TGT xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="TGT"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">61</PF:D_4753>

<PF:D_4754 xmlns:PF="http://www.post.ch/xml">20091013004004398880003000062412</PF:D_4754>

</PF:TGT>

<RFF>

<C506>

<D_1153 Value="ACD"></D_1153>

<D_1154>02</D_1154>

</C506>

</RFF>

<DTM>

<C507>

<D_2005 Value="209"></D_2005>

<D_2380>20091013</D_2380>

</C507>

</DTM>

<MOA>

<C516>

<D_5025 Value="210"></D_5025>

<D_5004>20.00</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<PF:EPC xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="EPC"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">1017</PF:D_4753>

</PF:EPC>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>VIREMENT DU COMPTE 80-533-6</D_4440>

<D_4440>MIGROS BANK AG</D_4440>

<D_4440>SEIDENGASSE 12</D_4440>

<D_4440>8001 ZÜRICH</D_4440>

<D_4440>EXPÉDITEUR:</D_4440>

<D_4440>XXXXXXXXXX XXXXXX</D_4440>

<D_4440>RUE DU GRAND BAY 3</D_4440>

<D_4440>1220 LES AVANCHETS</D_4440>

<D_4440>COMMUNICATIONS:</D_4440>

<D_4440>021550XXXX</D_4440>

</C108>

</FTX>

</SG6>

</SG4>

Red slip credit

<SG4>

<LIN>

<PF:D_0805 xmlns:PF="http://www.post.ch/xml" Value="LNE">

</PF:D_0805>

</LIN>

<SG5>

<MOA>

<C516>

<D_5025 Value="15"></D_5025>

<D_5004>16293.17</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<DTM>

<C507>

<D_2005 Value="202"></D_2005>

<D_2380>20091014</D_2380>

</C507>

</DTM>

</SG5>

<SG6>

<PF:TGT xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="TGT"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">61</PF:D_4753>

<PF:D_4754 xmlns:PF="http://www.post.ch/xml">20091012111604000300006000000012</PF:D_4754>

</PF:TGT>

<RFF>

<C506>

<D_1153 Value="ACD"></D_1153>

<D_1154>01</D_1154>

</C506>

</RFF>

<RFF>

<C506>

<D_1153 Value="ZZZ"></D_1153>

<D_1154>20091012111604000300006</D_1154>

</C506>

</RFF>

<DTM>

<C507>

<D_2005 Value="209"></D_2005>

<D_2380>20091014</D_2380>

</C507>

</DTM>

<MOA>

<C516>

<D_5025 Value="210"></D_5025>

<D_5004>11.05</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<PF:EPC xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="EPC"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">6019</PF:D_4753>

</PF:EPC>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>BULLETIN DE VERSEMENT</D_4440>

</C108>

</FTX>

</SG6>

</SG4>

Debit

<SG4>

<LIN>

<PF:D_0805 xmlns:PF="http://www.post.ch/xml" Value="LNE">

</PF:D_0805>

</LIN>

<SG5>

<MOA>

<C516>

<D_5025 Value="15"></D_5025>

<D_5004>1455.29</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<DTM>

<C507>

<D_2005 Value="202"></D_2005>

<D_2380>20091009</D_2380>

</C507>

</DTM>

</SG5>

<SG6>

<PF:TGT xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="TGT"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">61</PF:D_4753>

<PF:D_4754 xmlns:PF="http://www.post.ch/xml">20091008000800142375237000000103</PF:D_4754>

</PF:TGT>

<RFF>

<C506>

<D_1153 Value="ACD"></D_1153>

<D_1154>00</D_1154>

</C506>

</RFF>

<DTM>

<C507>

<D_2005 Value="209"></D_2005>

<D_2380>20091009</D_2380>

</C507>

</DTM>

<MOA>

<C516>

<D_5025 Value="211"></D_5025>

<D_5004>65000.00</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<PF:EPC xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="EPC"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">8999</PF:D_4753>

</PF:EPC>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>E-FINANCE 80-2-2</D_4440>

<D_4440>UBS AG</D_4440>

<D_4440>CH900024324326249801D</D_4440>

<D_4440>SWITZERNET (UBS ACC)</D_4440>

<D_4440>ACC. 243-262498.01D</D_4440>

<D_4440>1015 LAUSANNE</D_4440>

</C108>

</FTX>

</SG6>

</SG4>

Debit LNS

<SG4>

<LIN>

<PF:D_0805 xmlns:PF="http://www.post.ch/xml" Value="LNS">

</PF:D_0805>

</LIN>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="5"></D_4453>

<C108>

<D_4440>PRIX</D_4440>

</C108>

</FTX>

<SG5>

<MOA>

<C516>

<D_5025 Value="15"></D_5025>

<D_5004>48908.60</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<DTM>

<C507>

<D_2005 Value="202"></D_2005>

<D_2380>20091031</D_2380>

</C507>

</DTM>

</SG5>

<SG6>

<PF:TGT xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="TGT"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">61</PF:D_4753>

<PF:D_4754 xmlns:PF="http://www.post.ch/xml">20091031001001017133617000901107</PF:D_4754>

</PF:TGT>

<RFF>

<C506>

<D_1153 Value="ACD"></D_1153>

<D_1154>06</D_1154>

</C506>

</RFF>

<DTM>

<C507>

<D_2005 Value="209"></D_2005>

<D_2380>20091031</D_2380>

</C507>

</DTM>

<MOA>

<C516>

<D_5025 Value="211"></D_5025>

<D_5004>1466.40</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<PF:EPC xmlns:PF="http://www.post.ch/xml">

<PF:D_4752 xmlns:PF="http://www.post.ch/xml" Value="EPC"></PF:D_4752>

<PF:D_4753 xmlns:PF="http://www.post.ch/xml">7200</PF:D_4753>

</PF:EPC>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>POUR VERSEMENTS EN NUMÉRAIRE BV</D_4440>

</C108>

</FTX>

</SG6>

</SG4>

Totals

<SG4>

<LIN>

<PF:D_0805 xmlns:PF="http://www.post.ch/xml" Value="LTI">

</PF:D_0805>

</LIN>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>Total</D_4440>

</C108>

</FTX>

<SG6>

<MOA>

<C516>

<D_5025 Value="210"></D_5025>

<D_5004>4115.24</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

</SG6>

<SG6>

<MOA>

<C516>

<D_5025 Value="211"></D_5025>

<D_5004>0.00</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

</SG6>

</SG4>

Closing balance

<SG4>

<LIN>

<PF:D_0805 xmlns:PF="http://www.post.ch/xml" Value="LEN">

</PF:D_0805>

</LIN>

<FTX>

<D_4451 Value="ABN"></D_4451>

<D_4453 Value="0"></D_4453>

<C108>

<D_4440>ÉTAT DE COMPTE</D_4440>

</C108>

</FTX>

<SG5>

<MOA>

<C516>

<D_5025 Value="343"></D_5025>

<D_5004>19795.28</D_5004>

</C516>

<PF:D_5003 xmlns:PF="http://www.post.ch/xml">

+

</PF:D_5003>

</MOA>

<DTM>

<C507>

<D_2005 Value="202"></D_2005>

<D_2380>20091014</D_2380>

</C507>

</DTM>

</SG5>

</SG4>

</KONAUS>

<IC_TRAILER>

<ICINFO>

Veuillez contrôler l&apos;extrait de compte. Sauf avis contraire de votre part dans les 30 jours à venir, il sera considéré comme accepté.

</ICINFO>

<ICGRUSS>

Avec nos meilleures salutations</ICGRUSS><ICGRUSS></ICGRUSS><ICGRUSS>La Poste Suisse

</ICGRUSS>

<ICGRUSS>

PostFinance

</ICGRUSS>

</IC_TRAILER>

</IC>

END XML Flow

References

Postfinance XML file format changes, upgrade of the xml2doc script (this document)

http://switzernet.com/public/091105-postfinance-xml2doc/

http://unappel.ch/public/091105-postfinance-xml2doc/

[doc] [mht] [htm] [ms.htm] [pdf]

Previous version of the tool and user manuals

http://switzernet.com/public/080302-postfinance-xml2doc/

http://unappel.ch/public/080302-postfinance-xml2doc/

Related links at postfinance

Sur demande, les écritures des documents de compte électroniques peuvent vous être fournies par Postfinance au format XML, ce qui vous permet de les traiter ultérieurement à l'aide d'un logiciel d’e-finance ou de comptabilité apte à le lire

Document formats:

http://www.postfinance.ch/help/content/fr/help/edoc.html

Document FAQ:

http://www.postfinance.ch/help/content/fr/help/edoc/faq.html

Document specifications:

https://www.postfinance.ch/pf/content/fr/seg/biz/product/eserv/spec/edoc.html

The “Document manager” is software which can convert the XML files of postfinance account into a CSV format. However, it cannot retrieve the images and merge them into a single document (e.g. an MS Word file).

Downloads:

http://www.postfinance.ch/pf/content/fr/seg/priv/customer/download/sw.html

References to the message formats

The tag names of XML files of postfinance are based on the names of message segments specifications of UN/CEFACT TBG5, a standardization organization responsible for financial services under the United Nations Centre for Trade facilitation and Electronic Business (UN/CEFACT) and under the United Nations Economic Commission for Europe (UNECE). In 2004 SWIFT and UN/CEFACT TBG5 signed a convergence support agreement [080302 ii].

United Nations Directories for Electronic Data Interchange for Administration, Commerce and Transport

http://www.unece.org/trade/untdid/welcome.htm

http://www.unece.org/trade/untdid/d00a/trmd/stlrpt_c.htm

FINPAY, Message Implementation Guideline, Recommendation of UN/CEFACT (TBG5 Working Groups) Finance Domain

http://www.unece.org/trade/untdid/mig/finpay/tbg5_finpay_2002_2-0-0.pdf

Message Implementation Guides (MIGs) published by TBG Working Groups

http://www.unece.org/trade/untdid/mig/migs.htm

FINSTA D.96A, Financial statement of an account message, Recommendation for the domain of Finances for the use of the UN/EDIFACT-Messages

http://www.unece.org/trade/untdid/mig/finsta/finsta_v1-3-2.pdf

Financial statement of an account message, Recommendation of Swiss Financial Institutions for the use of the UN/EDIFACT-Messages

http://www.telekurs.com/dl_tkicch_finsta131.pdf

Direct debit message, Recommendation of Swiss Financial Institutions for the use of the UN/EDIFACT Message

http://www.telekurs.com/dirdeb_lsv_v10.pdf

Banking status message, Recommendation of Swiss Financial Institutions for the use of the UN/EDIFACT-Message as Message acknowledgment and/or status information

http://www.telekurs.com/dl_tkicch_bansta13.pdf

[080302 ii]

Swiss Interbank Clearing, the hub for payment traffic, operates the payment systems SIC and Euro SIC in Switzerland and across its borders

http://www.sic.ch/

ISO/TC 154-UN/CEFACT, Joint Syntax Working Group (JSWG), Database EDIFACT Syntax

http://www.gefeg.com/jswg/v41/data/v41.html

UN/EDIFACT, United Nations Standard Message (UNSM), Balance of payment customer transaction report message

http://www.stylusstudio.com/edifact/d04b/BOPCUS.htm

Go

Description

ATT

Attribute

BGM

Beginning of message

CNT

Control total

COM

Communication contact

CTA

Contact information

CUX

Currencies

DTM

Date/time/period

FII

Financial institution information

FTX

Free text

GIR

Related identification numbers

LIN

Line item

LOC

Place/location identification

MOA

Monetary amount

NAD

Name and address

PRI

Price details

QTY

Quantity

RCS

Requirements and conditions

RFF

Reference

EAN International

http://www.gs1.nl/hb_eancom/cremul/sc1.htm

EAN International, Direct debit message

http://www.gs1.se/eancom_2002/ean02s4/user/part2/dirdeb/041.htm

EDIFACT D6 Finance Working Group Meeting, Stockholm (June 19th-20th, 2000) “In Switzerland there are currently 2 projects in XML (a) Postfinance want to develop a statement of account based on FINSTA (the customer doesn’t know what syntax is behind the browser), including image references; (b) Swiss banks are also developing an XML message based on CREMUL (this is an interim solution and will move to an international standard as soon as there is one)”

http://crg.tbg5-finance.org/minutes/mn000619.doc

[080302 ii]

C516 values of opening and closing balance entries. FINSTA D.96A, Financial statement of an account message, Recommendation of D6 EWG sub-working group Finance for the use of the UN/EDIFACT-Message, Version 1.3.1 from February 16th, 2001

http://www.tbg5-finance.org/unece/mig/finsta/finsta_v1-3-1.pdf

References to other developers

Request to explain the format of postfinance XML files

http://www.developpez.net/forums/archive/index.php/t-251418.html

Perl links

Perl regular expressions quick start and tutorial

http://perldoc.perl.org/perlrequick.html

http://perldoc.perl.org/perlretut.html

Required packages

You need to install Cygwin (preferably completely including Perl) and Imagemagick.

Cygwin is a Linux-like environment for Windows [http://cygwin.com/]

ImageMagick is a software suite to create, edit, and compose bitmap images [http://www.imagemagick.org]

*   *   *

Copyright © 2009, Switzernet

www.switzernet.com