Préparation d`un fichier XML pour le reporting de la liste des clients
Transcription
Préparation d`un fichier XML pour le reporting de la liste des clients
Préparation d'un fichier XML pour le reporting de la liste des clients résidents et du nombre d'opérations Ed. 2007 © Banque nationale de Belgique, BruxellesTous droits réservés. La reproduction de cette publication, en tout ou en partie, à des fins éducatives et non commerciales est autorisée avec mention de la source. Table des matières 1. Introduction 5 2. Exclusions 6 3. Enquêtes concernées par le présent document 6 4. Identification du tableau 7 5. Structure du tableau : identification des colonnes 7 6. Exemple de tableau 8 7. Définition des données 9 7.1 7.2 Les données d'administration Les données de déclaration 9 10 8. XML Definition 11 8.1 Introduction 8.2 General Principles 8.2.1 Structure of content part 8.2.2 About CSSR admin parameters 8.3 XML Schema 8.3.1 'Client list' Dataset 8.3.2 'Client list' table 8.3.3 Table Number 8.3.4 Definition of a reported cell 8.3.5 Sequential number 8.3.6 Base 8.3.7 All XML Schema definitions together 8.4 Example Delivery 3 12 12 12 13 13 13 14 15 15 16 16 17 18 1. Introduction 1 Les déclarations statistiques adressées à la BNB sont collectées sous forme informatique à l'aide d'une 2 application Internet appelée CSSR . Cette application permet : ─ l'envoi de fichier par e-mail au format XML; ─ l'encodage de la déclaration à l'aide du formulaire Internet ; ─ le téléchargement sécurisé de fichiers au sein du formulaire Internet au format CSV et ─ le téléchargement sécurisé de fichiers par Internet au format XML. Ce document décrit la préparation d'un fichier XML pour le reporting de la liste des clients résidents et du nombre d'opérations. Il est important de retenir que le reporting est basé sur les concepts suivants : ─ enquête, ─ tableau, ─ ligne, ─ colonne et ─ cellule. Ces concepts sont définis ci-après et illustrés par un exemple concret. 1 BNB : Banque Nationale de Belgique 2 CSSR : Central Server for Statistical Reporting (serveur central pour les déclarations statistiques) 5 2. Exclusions Pour la préparation d'un fichier au format CSV, il faut se référer à la documentation de chaque enquête. Pour la préparation d'un fichier XML pour le reporting des "activités avec l'étranger avec l'étranger concernant les services, les transferts et les marchandises", il faut se référer à la documentation adéquate. 3. Enquêtes concernées par le présent document Seules les enquêtes et tableaux identifiés ci-dessous appliquent les règles mentionnées dans ce document. IDENTIFANT DE NOM DE L'ENQUÊTE L'ENQUÊTE L01PKI Liste des clients résidents et du nombre d'opérations 6 4. Identification du tableau L'enquête reprise ci-dessus nécessite le reporting d'un seul tableau. Il s'agit du tableau 0010. Il est indispensable de respecter la forme de ce tableau dans chaque rapport Tableau 00.10 Liste des clients résidents et du nombre d'opérations 5. Structure du tableau : identification des colonnes Chaque tableau est composé de lignes et de colonnes. Dans un tableau, les différents enregistrements sont disposés sous forme de lignes successives identifiées par des nombres séquentiels. Dans une colonne, on trouvera toujours le même type d'information dans les différents enregistrements successifs. Les colonnes sont conventionnellement identifiées par un numéro de colonne qui a la même signification dans tous les tableaux. Une donnée est enregistrée dans une cellule située au croisement d'une ligne et d'une colonne. Les colonnes portent les numéros suivants : 99 Numéro d'entreprise (ou de TVA) du client 50 Nombre de paiements exécutés vers l'étranger 60 Nombre de paiements reçus de l'étranger 7 6. Exemple de tableau Cet exemple est issu de l'enquête L01PKI, tableau 0010 : " Liste des clients résidents et du nombre d'opérations ". N° D'ENTREPRISE NOMBRE DE PAIEMENTS DU CLIENT EXÉCUTÉS VERS L'ÉTRANGER NOMBRE DE PAIEMENTS REÇUS DE L'ÉTRANGER 99 50 60 1 0203201340 500000 500001 2 0489987365 10 20 La ligne 1 de cet exemple contient un enregistrement qui indique que l'entreprise 0203201340 a effectué 500 000 paiements vers l'étranger et qu'elle a reçu 500 001 paiements en provenance de l'étranger. La cellule située au croisement de la ligne "1" et de la colonne "99" contient la mention "0203201340". Pour en revenir aux concepts, on a : ─ enquête : "L01PKI" ─ tableau : "0010" ─ ligne : "1" ─ colonne : "99" ─ valeur de la cellule identifiée par la ligne "1" et la colonne "99" : "0203201340". 8 7. Définition des données Le fichier XML contient deux types de données : ─ les données d'administration et ─ les données de déclaration. 7.1 Les données d'administration Ces données servent à administrer les fichiers envoyés, identifier l'expéditeur, identifier le contenu ainsi que de préciser par quelle voie l'accusé de réception et le rapport de validation doivent être envoyés à l'expéditeur. Ces données sont les suivantes : DONNÉE DESCRIPTION FORMAT EXEMPLE admin creation_time date de création du fichier yyyy-mm-dd hh:mm:ss "2006-01-10 12:05:32" sender kbo n° d'entreprise (ou numéro de TVA) ou identification de l'OPC Num(10) "0402325689" Texte "BE2003069561CBF" name nom de la personne de contact texte libre "Durand Robert" Email adresse E-mail de la personne de contact texte libre "robert.durant@enterprise. be" telephone N° de téléphone texte libre "02/355.15.15" fax N° de fax texte libre "02/355.80.10" email_response adresse E-mail pour l'envoi de l'accusé de réception par la BNB texte libre "robert.durant@entreprise. be" transform_response le rapport de validation de la déclaration doit être envoyé en format lisible ("true") ou en format html machine ("false") bolean : "true" "false" "true" transform_acknowledgement l'accusé de réception est en format lisible par l'homme ("true") ou en format XML ("false") bolean : "true" "false" "true" secure_response le rapport de validation doit être encrypté ('true") ou non encrypté ("false") uniquement pour option strong secure - bolean : "true" "false" "false" 9 DONNÉE DESCRIPTION FORMAT EXEMPLE secure_acknowledgement l'accusé de réception doit être encrypté ('true") ou non encrypté ("false") uniquement pour option strong secure - bolean : "true" "false" 'true" lang langue de contact X(2) valeurs : "nl" = Nederlands "fr" = Français "de" = Deutsch "en" = English "fr" xsi:type domaine d'application = balance des paiements texte "PrtAcquisitionDataset " survey identifiant de l'enquête texte " L01PKI" per période de reporting yyyy-mm "2007-01" tblnr identifiant du tableau texte "0010" bas base de reporting N(2) valeur "99" obligatoire "99" nihil précise si des transactions ont eut lieu pour la période bolean : "true" "false" "true" (= rien à déclarer) Les données de déclaration 7.2 Les données de la déclaration identifient les cellules de chaque tableau par les coordonnées des lignes et des colonnes et enregistrent le contenu de chaque cellule. DONNÉE DESCRIPTION FORMAT EXEMPLE cell identification de l'élément cellule - "0203201340" rub identification de la ligne du rapport texte "1" col identification de la colonne texte "99" 10 8. XML Definition Revision History Revision 1.0 27 May 2005 Table of Contents 8.1. Introduction 8.2. General Principles 8.2.1. Structure of content part 8.2.2. About CSSR admin parameters 8.3. XML Schema 8.3.1. Client list Dataset 8.3.1.1. Description 8.3.1.2. XML Schema Definition 8.3.1.3. Details 8.3.2. Client list table 8.3.2.1. Description 8.3.2.2. XML Schema Definition 8.3.2.3. Details 8.3.3. Table Number 8.3.3.1. Description 8.3.3.2. XML Schema Definition 8.3.3.3. Details 8.3.4. Definition of a reported cell 8.3.4.1. Description 8.3.4.2. XML Schema Definition 8.3.4.3. Details 8.3.5. Sequential number 8.3.5.1. Description 8.3.5.2. XML Schema Definition 8.3.5.3. Details 8.3.6. Territorial Base 8.3.6.1. Description 8.3.6.2. XML Schema Definition 8.3.6.3. Details 8.3.7. Currency Code 8.3.7.1. Description 8.3.7.2. XML Schema Definition 8.3.7.3. Details 8.4. All XML Schema definitions together 8.5. Example Delivery 11 8.1 Introduction The reporting for the 'Client list' is done via the Central Server for Statistical Reporting (CSSR). In this document only specific information related to the reporting itself is described. For general information about usage and functionality of CSSR, we refer to its website.1. To give a quick summary, a cssr document is divided into two parts ─ Admin part : containing definitions to control the processing of the transfer. This part is independent of the reporting it contains; ─ Content part : an application specific part containing the actual data to report. It is the content part that is further described in this document. A first section will describe the general principles of how the data is structured. Then a detailed description is given of the XML Schema at which the <content> element of the XML document must satisfy. Small examples will be given with their associated definition of the part it highlights. A subsequent section will give the complete XML Schema, followed by a last section with an example of a valid cssr document containing a fictional reporting. 8.2 General Principles 8.2.1 Structure of content part The data to report is organized into tables. A table is a two dimensional structure made of : ─ rows identified by a numerical id ─ columns. The tables are identified by ─ reporting period the data relates to ─ a table number, for example 0492 ─ a territorial base - for example 10 <table per="2007-01" tblnr="0010" bas="99" survey="L01PKI"> ... </table> Cells are making up the crossing between a row and a column identified by a sequential number and a column code respectively. A cell can contain only one value. <table per="2007-01" tblnr="0010" bas="99" survey="L01PKI" > <cell rub="1" col="099">0203201340</cell> <cell rub="1" col="050">500000</cell> <cell rub="1" col="060">500001</cell> </table> 1] [2] by following Statistics > Declarations > Summary in other words it is defined by mlns:xsd="http://www.w3.org/2001/XMLS 12 If a declarer has no cells to report, then the table can be declared “nihil” by using the nihil attribute. The specific tables which are part of the' Client list' can variate in time and will be described in an additional document. In that, for each table, a table number and a list of columns is described. For each column the column code, the format and the semantics will be given. 8.2.2 About CSSR admin parameters Concerning some CSSR admin parameters, we have : ─ As content_type = 'PrtAcquisitionDataset' ─ The test parameter is not applicable ─ As lang processing parameter may be used, as default 'English' is assumed. 8.3 XML Schema This schema needs definitions defined elsewhere in CSSR. 8.3.1 'Client list' Dataset 8.3.1.1 Description Definition of a 'Client list' dataset containing the tables to report:. The <content> element. <content xsi:type="PrtAcquisitionDataset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.nbb.be/cssr"> the table elements </content> 8.3.1.2 XML Schema Definition <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PrtAcquisitionDataset"> <xsd:complexContent> <xsd:extension base="cssr:Content"> <xsd:sequence> <xsd:element name="table" type="cssr:PrtAcquisitionTable" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="survey" type="xsd:string" use="required" /> </xsd:extension> </xsd:complexContent> </xsd:complexType> 8.3.1.3 Details Content : complex Inheriting elements and attributes from the definition of cssr:Content ATTRIBUTES NAME survey TYPE xsd:string REQUIRED DEFAULT VALUE Yes DESCRIPTION Code to identify the survey 13 CONTENT : A SEQUENCE OF THE FOLLOWING ELEMENTS IN STRICT ORDER NAME table TYPE MIN cssr:PrtAcquisitionTable 8.3.2 'Client list' table 8.3.2.1 Description 1 MAX DESCRIPTION N A table is the minimal unit of reporting, so when one cell must be updated the complete table must be send again. <table> element <table per="2007-01" tblnr="0010" bas="99" survey="L01PKI" nihil="false"> ... cell elements ... </table> <table> element for a nihil declaration <table per="2007-01" tblnr="0010" bas="99" survey="L01PKI" nihil="true" /> 8.3.2.2 XML Schema Definition <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PrtAcquisitionTable"> <xsd:sequence> <xsd:element name="cell" type="cssr:PrtCell" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="per" type="xsd:gYearMonth" use="required" /> <xsd:attribute name="tblnr" type="cssr:PrtTableNumber" use="required" /> <xsd:attribute name="bas" type="cssr:PrtBase" use="required" /> <xsd:attribute name="nihil" type="xsd:boolean" default="false" /> </xsd:complexType> 8.3.2.3 Details ATTRIBUTES NAME TYPE REQUIRED DEFAULT DESCRIPTION VALUE per xsd:gYearMonth Yes tblnr cssr:PrtTableNumber Yes bas cssr:PrtBase Yes nihil xsd:boolean No Reporting period to where the data refers to false Used to denote that the table is a nihil declaration (true) or not (false). For a nihil declaration no cells may be reported. CONTENT : A SEQUENCE OF THE FOLLOWING ELEMENTS IN STRICT ORDER NAME cell TYPE cssr:PrtCell MIN 0 MAX DESCRIPTION N 14 8.3.3 Table Number 8.3.3.1 Description Identification of a table For example 0010 but not 00.10 8.3.3.2 XML Schema Definition <xsd:simpleType xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PrtTableNumber"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{4}" /> </xsd:restriction> </xsd:simpleType> 8.3.3.3 Details Restriction based on xsd:string 8.3.4 Definition of a reported cell 8.3.4.1 Description The cell is the smallest unit inside a table, to report. It corresponds to a single value. The <cell> element contains a value to report. Any alphanumerical string is allowed although some restriction applies which are defined in the application. Its format depends on the actual data type expected for the indicated column and table. The following table describes the possible data types. The format of the data types which corresponds to a definition in the XML Schema standard, are identical to the format described there. XML SCHEMA/DATA TYPE DESCRIPTION EXAMPLE string a finite sequence of characters. Only characters defined in the "ASCII extended character set" are accepted decimal A real number with in theory infinite precision • 210 A point will be used as decimal separator and no grouping character will be used to separate thousands • 12667.543 When according to the definition of the table, more decimals are reported then defined, they will be truncated. • +1000.00 • -1.23 In the validation process, based on the definition of the indicated column, restriction are applied on the actual maximal length of a string and the number of significant digits and the scale in case of a decimal. When a decimal is reported with less precision then the one expected according to the column definition, zeros are assumed for the higher precision digits. For example 1.1 will be treated as 1.1000... . Some examples of the <cell> element : <cell rub="1" col="099">0203201340</cell> <cell rub="1" col="050">500000</cell> <cell rub="1" col="060">500001</cell> 15 8.3.4.2 XML Schema Definition <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PrtCell"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="rub" type="cssr:PrtSeqNumber" use="required" /> <xsd:attribute name="col" type="xsd:string" use="required" /> </xsd:extension> </xsd:simpleContent> </xsd:complexType> 8.3.4.3 . Details Content : simple Inheriting elements and attributes from the definition of xsd:string ATTRIBUTES NAME TYPE REQUIRED DEFAULT VALUE DESCRIPTION rub cssr:PrtSeqNumber Yes Sequential code col xsd:string Yes Column Code 8.3.5 Sequential number 8.3.5.1 Description A positive integer, starting from 1. Gaps between the numbering are allowed, its only purpose is to uniquely identify a reported item 8.3.5.2 XML Schema Definition <xsd:simpleType xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PrtSeqNumber"> <xsd:restriction base="xsd:integer"> <xsd:minExclusive value="0" /> </xsd:restriction> </xsd:simpleType> 8.3.5.3 Details Restriction based on xsd:integer 8.3.6 Base 8.3.6.1 Description 8.3.6.2 XML Schema Definition <xsd:simpleType xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PrtBase"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="10" /> <xsd:enumeration value="19" /> <xsd:enumeration value="99" /> </xsd:restriction> </xsd:simpleType> 16 8.3.6.3 Details Restriction based on xsd:string ENUMERATION, MUST BE ONE OF THE FOLLOWING VALUES VALUE 8.3.7 DESCRIPTION 10 Territorial basis - excluded for L01PKI 19 Foreign seats - excluded for L01PKI 99 Reporting list of clients - only for L01PKI All XML Schema definitions together The following XML Schema contains all definitions for the content part of the 'Client list' reporting'. References to types for which the prefix is xsd, refers to the one made in the XML Schema specifications. 1 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.nbb.be/cssr" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:complexType name="PrtAcquisitionDataset"> <xsd:complexContent> <xsd:extension base="cssr:Content"> <xsd:sequence> <xsd:element name="table" type="cssr:PrtAcquisitionTable" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="survey" type="xsd:string" use="required" /> </xsd:extension> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="PrtAcquisitionTable"> <xsd:sequence> <xsd:element name="cell" type="cssr:PrtCell" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="per" type="xsd:gYearMonth" use="required" /> <xsd:attribute name="tblnr" type="cssr:PrtTableNumber" use="required" /> <xsd:attribute name="bas" type="cssr:PrtBase" use="required" /> <xsd:attribute name="nihil" type="xsd:boolean" default="false" /> </xsd:complexType> <xsd:simpleType name="PrtTableNumber"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[0-9]{4}" /> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="PrtCell"> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="rub" type="cssr:PrtSeqNumber" use="required" /> <xsd:attribute name="col" type="xsd:string" use="required" /> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:simpleType name="PrtSeqNumber"> 1 in other words it is defined by mlns:xsd="http://www.w3.org/2001/XMLS 17 <xsd:restriction base="xsd:integer"> <xsd:minExclusive value="0" /> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="PrtBase"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="10" /> <xsd:enumeration value="19" /> <xsd:enumeration value="99" /> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="ISOCurrency"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Z]{3}" /> </xsd:restriction> </xsd:simpleType> </xsd:schema> 8.4 Example Delivery The following example is pure fictional and is not complete. It just demonstrates how cell values must be reported. <cssr_document xmlns="http://www.nbb.be/cssr"> <admin creation_time="2006-04-05T10:20:00.000"> <sender kbo="1234567890"> <contact> <name>Mr. X</name> <communication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Email" address="[email protected]" /> <communication xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Telephone" number="02/987.654.32" /> </contact> </sender> <receiver /> <processing_parameters> <email_response>[email protected]</email_response> <transform_response>true</transform_response> </processing_parameters> <description>This is a user-description of the delivery</description> </admin> <content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="PrtAcquisitionDataset"> <table per="2007-01" tblnr="0010" bas="99" survey="L01PKI"> <cell rub="1" col="099">0203201340</cell> <cell rub="1" col="050">500000</cell> <cell rub="1" col="060">500001</cell> <cell rub="2" col="099">0489987365</cell> <cell rub="2" col="050">10</cell> <cell rub="2" col="060">20</cell> </table> </content> </cssr_document> 18 Pour de plus amples informations Si vous souhaitez obtenir de plus amples informations à propos de ce manuel et de la méthodologie, vous pouvez vous adresser au service Balance des paiements Tél. +32 2 221 20 81 – Fax +32 2 221 31 44 [email protected] Editeur responsable Jean-Jacques Vanhaelen Chef du département de la Statistique générale Banque nationale de Belgique boulevard de Berlaimont, 14 – BE-1000 Bruxelles © Illustrations: Gettyimages – Photodisc Gettyimages – Digital Vision Banque nationale de Belgique Mise en pages: BNB – Balance des paiements Couverture: Prepress & Image NBB Publié en octobre 2006. 19