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
When a file is transformed into XML, the resulting XML has the following structure:Items. The name of all record elements is determined by the Record Name option set in Connector Settings. Each record element then has child elements corresponding to the values in each row of the input file.
Some files include a line of header information that provides context to the values in the file. When the First line is header information setting is enabled, this header line is parsed, and the parsed headers are used as the element names for the value elements (the children of the record elements). Otherwise, the value elements are given generic names such as field_0, field_1, and so on.
Converting XML to CSV
To convert XML to a file, the input XML must have a ‘flat’ structure. This means that, disregarding theItems root element, the depth of the XML structure is two. For example:
- Children of the root element are treated as records (rows) in the resulting file
- Children of each record element are treated as the values in each row
title, year, and runtime.
Print View
CSV Transformation: Using the XML Map Connector
CSV Operations
In addition to the Operations provided with Arc, connectors can provide operations that extend functionality into ArcScript. These connector operations can be called just like any other ArcScript operation, except for two details:- They must be called through the
connector.rscendpoint. - They must include an auth token.
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 theItemName column. The following script generates XML containing each ItemName value in an Item element: