Skip to main content
Version: 4.51.0

File Reader

The File Reader component reads text-based files (such as .csv-files) and it's able to parse them. The local file system or a cloud storage can be used. In order to access the local filesystem, the XILL4_WORKDIRS environment variable must be set to the path of the directory to be accessed.

Configuration

Display Settings
Path

Path to the file, can be a variable.

Example 1: ../test.csv

Example 2: %filePath%

Example 3: C:/testFolder

The component also supports reading out files from a cloud storage.

Example 4: <cloud-storage>://testFolder/test.csv

Encoding

One of the following encodings can be chosen:

  • UTF-8
  • ASCII

Parsing

Parse CSV

Parses CSV, separating using the delimiter.

Delimiter

The symbol that will separate columns.

Example:

With delimiter semicolon


Input row: first,name;last name
Output: ['first,name', 'last name']

Text qualifier

The character to use to quote fields that contain a delimiter.


Input row: "first,name",last name
Output: ["first,name", "last name"]

Treat first row as a header

Transforms the rows into objects where the keys are the headers (first row)

Example:

{
"first name": "Jason",
"last name": "Dick"

}

Parse XML

Parses XML. The following configuration can be applied to the parser. By default, attributes and comments are not parsed.

Allow Boolean Attributes

Allows attributes without value. By default, boolean attributes are ignored. When set to true:

<hello checked>

world

</hello>

will be parsed to:

{
hello: {
"@_checked": true,
"#text": "world"
}
}

Always Create Text Node

Force rendering a tag with a text node. Otherwise, it creates a property with the tag name and assigns the value directly.

Example:

<hello>

world

</hello>

With alwaysCreateTextNode set to false:

{
hello: "world"
}

With alwaysCreateTextNode set to true:

{
hello: {
"#text": "world"
}
}

Parse Comments

Comments are parsed with prop name @_comments.

Example:

<hello>

<!--world-->

</hello>

Will parse to:

{
hello: {
"@_comments": "world"
}
}

Ignore Attributes

Attributes are ignored by the parser. By default set to true. This also means that any configuration regarding attributes will not apply.

Parse Attribute Value

Force parsing the attribute value. This is relevant when attribute values have another type than string.

Example:

<hello attr="true">

world

</hello>

With parseAttributeValue set to false:

{
hello: {
"@_attr": "true"
}
}

With parseAttributeValue set to true:

{
hello: {
"@_attr": true
}
}

Parse Tag Value

Force parsing the tag value. Same logic applies as with parseAttributeValue.

Preserve Order

Used to keep the order of tags in the result object.

Remove NS Prefix

Remove namespace string from tag and attribute names.

Example:

<ns:hello ns:attr="true">

world
</ns:hello>

Will parse to:

{
"hello": {
"@_attr": "true"
}
}

Unpaired Tags

Unpaired Tags are the tags which don't have matching closing tag. Eg <br> in HTML. You can parse unpaired tags by setting the unpaired tags separated by a comma (,).

Example:

<hello>

world

<br>
</hello>

With unpairedTags set to br will parse to:

{
hello: {
"#text": "world",
unpaired: ""
}
}

Parse JSON

Parses the file as a JSON and outputs an object.

Inputs | Outputs


File Reader
Input
Output
Error
0 0 0 (ilsux488)

Takes any input as a trigger. If the input is an object with the path key, this value will replace the path in the configuration.

  • Example:

    {
    "path" : "C:\Migration Data\new.csv"
    }