# ConvertToXML

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.CSV2/tree/main/Frends.CSV.ConvertToXML>

{% tabs %}
{% tab title="Parameter: Input" %}

| Name                                           | Description                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Csv : `String`                                 | <p>Input csv string</p><p><br>Default: <code>-</code><br>Example: <code>1;Foo;Bar</code></p>                                                                                                                                                                                                |
| Delimiter : `String`                           | <p>Delimiter.</p><p><br>Default: <code>;</code><br>Example: <code>;</code></p>                                                                                                                                                                                                              |
| ColumnSpecifications : `ColumnSpecification[]` | <p>You can map columns to specific types.</p><p>The order of the columns are used for mapping, that means that the ColumnSpecification elements need to be created in the same order as the CSV fields.</p><p><br>Default: <code>-</code><br>Example: <code>\[ { foo, String } ]</code></p> |
| {% endtab %}                                   |                                                                                                                                                                                                                                                                                             |

{% tab title="Parameter: Options" %}

| Name                                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                       |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| ContainsHeaderRow : `Boolean`                   | <p>This flag tells the reader if there is a header row in the CSV string.</p><p><br>Default: <code>true</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                            |                                                                       |
| TrimOutput : `Boolean`                          | <p>This flag tells the reader to trim whitespace from the beginning and ending of the field value when reading.</p><p><br>Default: <code>true</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                      |                                                                       |
| SkipRowsFromTop : `Int32`                       | <p>If the CSV string contains metadata before the header row you can set this value to ignore a specific amount of rows from the beginning of the csv string.</p><p><br>Default: <code>0</code><br>Example: <code>2</code></p>                                                                                                                                                                                                                                                                              |                                                                       |
| SkipEmptyRows : `Boolean`                       | <p>A flag to let the reader know if a record should be skipped when reading if it's empty.</p><p>A record is considered empty if all fields are empty.</p><p><br>Default: <code>true</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                               |                                                                       |
| ReplaceHeaderWhitespaceWith : `String`          | <p>If intended header value contains whitespaces replace it(them) with this string, default action is to do nothing.</p><p><br>Default:<br>Example: <code>" "</code></p>                                                                                                                                                                                                                                                                                                                                    |                                                                       |
| CultureInfo : `String`                          | <p>The culture info to read/write the entries with, e.g. for decimal separators.</p><p>InvariantCulture will be used by default.</p><p>See list of cultures here: <https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.name?view=net-7.0></p><p>NOTE: Due to an issue with the CsvHelpers library, all CSV tasks will use the culture info setting of the first CSV task in the process; you cannot use different cultures for reading and parsing CSV files in the same process. | </p><p><br>Default: <code>-</code><br>Example: <code>fi-FI</code></p> |
| TreatMissingFieldsAsNulls : `Boolean`           | <p>The flag for reader to treat missing fields as nulls instead of throwing a MissingFieldException.</p><p>In case of providing column specifications manually the value of empty field defined as string will be empty instead of null</p><p><br>Default: <code>true</code><br>Example: <code>true</code></p>                                                                                                                                                                                              |                                                                       |
| XmlRootElementName : `String`                   | <p>Specifies the name for the XML root element.</p><p><br>Default: <code>Root</code><br>Example: <code>Root</code></p>                                                                                                                                                                                                                                                                                                                                                                                      |                                                                       |
| XmlRowElementName : `String`                    | <p>Specifies the name for the XML row element.</p><p><br>Default: <code>Row</code><br>Example: <code>Row</code></p>                                                                                                                                                                                                                                                                                                                                                                                         |                                                                       |
| IgnoreQuotes : `Boolean`                        | <p>A flag to let the reader know if quotes should be ignored.</p><p><br>Default: <code>false</code><br>Example: <code>false</code></p>                                                                                                                                                                                                                                                                                                                                                                      |                                                                       |
| IllegalNodeNameAction : `IllegalNodeNameAction` | <p>If a converted node name is illegal, a selected action will be taken.</p><p>Possible values:</p><ul><li><code>ThrowError</code>:</li></ul><p>If a converted node name is illegal, a selected action will be taken.</p><ul><li><code>Overwrite</code>:</li></ul><p>If a converted node name is illegal, a selected action will be taken.</p><p><br>Default: <code>1</code><br>Example: <code>ThrowError</code></p>                                                                                        |                                                                       |
| IllegalNodeNamePrefix : `String`                | <p>A prefix that will be added to illegal node names. If it's empty, the prefix will be "\_"</p><p><br>Default: <code>-</code><br>Example: <code>Pref</code></p>                                                                                                                                                                                                                                                                                                                                            |                                                                       |
| {% endtab %}                                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                       |

{% tab title="Result: Result" %}

| Name                | Description                                                                              |
| ------------------- | ---------------------------------------------------------------------------------------- |
| Success : `Boolean` | <p>Operation complete without errors.<br>Example: <code>true</code></p>                  |
| Xml : `String`      | <p>Result as XML.<br>Example: <code>"\r\n\r\n \r\n 1\r\n foo\r\n bar\r\n\r\n"</code></p> |
| {% endtab %}        |                                                                                          |

{% tab title="Changelog" %}

## Changelog

### \[1.5.0] - 2026-01-21

#### Added

* Add options to fix illegal node names. The default behavior is throwing an error if the node name is invalid.

### \[1.4.0] - 2025-12-29

#### Added

* Add option to ignore quotes.

### \[1.3.0] - 2025-12-05

#### Changed

* Update package CsvHelper to version 33.1.0.

### \[1.2.0] - 2025-10-06

#### Changed

* Updated Repository link in the metadata.

### \[1.1.0] - 2024-08-20

#### Added

* Updated NewtonSoft.Json to the latest version 13.0.3.

### \[1.0.0] - 2023-08-24

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
