Skip to main content
The CSV connector converts comma-separated values (CSV) files into XML and generates CSV files from XML.

Key Capabilities

  • Bidirectional CSV/XML conversion with configurable delimiters and encoding
  • Header detection and custom column mapping capabilities
  • Support for various character encodings and special character handling

Overview

Connector Configuration

This section contains all of the configurable connector properties.

Settings Tab

Configuration

Settings related to the connector Id and description.

Connector Settings

Settings related to the core operation of the connector.

Other Settings

Settings not included in the previous categories.

Sample Files Tab

Advanced Tab

Logging

Miscellaneous

Automation Tab

Automation Settings

Performance

Alerts Tab

SLAs Tab

Converting CSV to XML

ファイルが XML に変換されると、生成される XML は次の構造になります。
元のファイルの各行(レコード)は、ルート要素 Items の子になります。すべてのレコード要素の名前は、コネクタ設定で設定された Record Name オプションによって決定されます。各レコード要素は、入力ファイルの各行の値に対応する子要素を持ちます。 一部の ファイルには、ファイル内の値にコンテキストを提供するヘッダー情報の行が含まれています。First line is header information 設定が有効になっている場合、このヘッダー行が解析され、解析されたヘッダーが値要素(レコード要素の子)の要素名として使用されます。それ以外の場合、値要素には field_0field_1 のような汎用的な名前が付けられます。

Converting XML to CSV

XML を ファイルに変換するには、入力 XML が「フラット」な構造になっている必要があります。これは、Items ルート要素を除いた XML 構造の深さが2であることを意味します。次に例を示します。
XML は次のように解釈されます。
  • ルート要素の子は、生成されるファイルのレコード(行)として扱われます
  • 各レコード要素の子は、各行の値として扱われます
First line is header information オプションが有効になっている場合、値にコンテキストを提供するために、各値要素の名前を含むヘッダー行が、生成される ファイルに挿入されます。上記の例では、このヘッダー行は titleyearruntime で構成されます。

CSV Transformation: Using the XML Map Connector

CSV Operations

Arc に付属する操作に加えて、コネクタは ArcScript に機能を拡張する操作を提供できます。 これらのコネクタ操作は、他の ArcScript 操作と同じように呼び出すことができますが、次の2点が異なります。
  1. connector.rsc エンドポイントを介して呼び出す必要があります。
  2. 認証トークンを含める必要があります。
たとえば、これら両方のルールを使用してコネクタ操作を呼び出す場合は、次のようになります。
Operations specific to the functionality of the CSV connector are listed below.

csvListRecords

Loops over every record in a specified CSV file or string. See Functions for more details.

Required Parameters

  • file: The path to the CSV file.

Optional Parameters

  • data: If the CSV data exists as a string rather than stored in a CSV file, use this parameter instead of file.
  • columns: The comma-separated list of columns to include in the output (if unspecified, all columns are included).
  • requireheader: By default, the first row of data is interpreted as column headers; pass false to this parameter to use generic column names (for example, c1, c2, c3).

Output

Any script in a csvListRecords operation executes multiple times: once for each record/row in the input CSV file/data. Within the operation, individual CSV values are accessible using the csv formatter. This formatter takes a column name as a parameter, and outputs the value in that column for the current record. For example, imagine the CSV input data contains a set of items purchased in an order, and the name of the item is held in the ItemName column. The following script generates XML containing each ItemName value in an Item element:

Macros

Examples