# XML Converter

### ![](https://1143774439-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ooXfQ2qWGFRh6lihybt%2Fuploads%2Fgit-blob-b1ff09efdc12bf5f66706c589ab22a99da1cb7dd%2FIcon_TOB_program.gif?alt=media)

### Abstract

This plug-in enables the import of XML files (.xml) into the built-in test database and/or their conversion into flat CSV files (.csv) within OMrun. By default, both input and output files use UTF-8 encoding. However, the encoding can be individually customized through the application configuration.

**Encoding CSV Input/Output Format**

It is possible to define an encoding for the csv file:

* UTF8 \[with BOM]
* UTF8 without BOM (Default)
* ANSI
* `UTF7 (decommissioned)`
* UTF32
* ASCII
* BigEndianUnicode
* Unicode

***

### Input

**Allowed file types / formats**

* \*.xml (Standard xml format)
* \*.txt (file with txt extension or any other file with a different extensions, containing a valid xml structure)
* \*.tor, \*.cfg, \*.tob, \*.tsc, \*.env, \*.rtl (all OMrun specific files)

**Prohibited file types / formats**

* \*.exe (Executables)
* \*.csv (Converter result files or standard csv files)

The XML plug-in supports 3 different types of conversion:

* **Database Multi Deletion**\
  Deletes all data tables in the built-in test database of OMrun.
* **Database Single Conversion**\
  Loads an xml file into the built-in test database of OMrun. Deletes tables with the same system prefixes in advance.
* **Flatfile Single Conversion**\
  Loads an xml file into the built-in test database of OMrun and converts it into a csv output file.

For each uniquely named XML file that is loaded, a corresponding header file is automatically created. This header file contains a fixed list of attribute names, ensuring consistency even if the XML files have different structures under the same schema.

* Queries remain stable despite structural changes in the XML.
* Unwanted attributes can be removed from the header file to exclude them from future loads.
* Deleting the header file resets the attribute selection; all attributes are reloaded and a new header file is generated.
* Each XML file load generates a query that reads both the content and the schema of the XML structure.

***

### Parameters

#### Database Multi Deletion

Field `@param1` = \<Empty>\
Field `@param2` = \<Empty>\
Field `@param3` = \<Empty>\
Field `@param4` = \<Empty>

#### Database Single Conversion

Field `@param1` (Input file) \[mandatory]

* Description: Source location incl. file name + extension
* Syntax: \<full path>\\\<file name>.xml (or any other extension except \*.exe, \*.csv)
* Examples:

```
"C:\Input\Data\Test.xml"
"C:\OMrun\Results\Result.tor"
```

Field `@param2` (System prefix) \[optional]

* Description: System prefix name used as prefix for table names
  * \<Empty> uses standard prefix "SourceA".
  * \<System prefix> uses defined system prefix, max. char lenght 20
* Example: Nest\_Person, OMrun\_Person etc.

Field `@param3` = \<Empty>\
Field `@param4` = \<Empty>

#### Flatfile Single Conversion

Field `@param1` (Input file) \[mandatory]

* Description: Source location incl. file name + extension
* Syntax: \<full path>\\\<file name>.xml (or any other extension except \*.exe, \*.csv)
* Examples:

```
"C:\Input\Data\Test.xml"
"C:\OMrun\Results\Result.tor"
```

Field `@param2` (Output path) \[mandatory]

* Description: Target location of converted files
* Syntax: \<full path> (without ending backslash)
* Example: @TestCases\OMrun\Mapping\_Business\_Rules\Convert\_Result\_Before\_Verify

Field `@param3` (Output file) \[optional]

* Description: Target file name + extension
* Syntax: \<file name>.\<extension> (without backslash at beginning)
* Example: Result\_Ready2Verify\_Amber.csv
* Possible values:
  * \<file name>.csv
  * csv (taking input file name and converting into csv)
  * \* \[or] \<empty> (default = File name from @param1 and converted into csv)

Field `@param4` (Header definition file) \[optional]

* Description: File (csv) with all headers generated from XML file
* Syntax: \<file name.csv>
* Example: Filename\_HeaderDefinition.csv
* Possible values:
  * \<header definition file name.csv> (= File will be converted with this header definition file)
  * \* \[or] \<empty> (=No value converts each file with its own header file generated)

***

### Output

Output format of the CSV file is UTF8 by default. Different formats for the input and output file can be set in config file (admin rights needed).

***

## Parameters in OMrunPlugIn\_XmlConverter.exe.config

Remove color tag from tor result, false=remove (Default) / true=keep

* add key="KeepColorTag" value="false"

Auto update header, false=NoUpdate (Default) / true=AutoUpdate

* add key="AutoUpdateHeader" value="false"

For converter output, UTF8 without BOM (Default), ANSI, ASCII, BigEndianUnicode, UTF7, UTF8, UTF32, Unicode:

* add key="InputFileEncoding" value="UTF8 without BOM"
* add key="OutputFileEncoding" value="UTF8 without BOM"

Delimiter for csv output file, ";" (Default), all other char possible, us = ","

* add key="Delimiter" value=";"

System path: `C:\Program Files\dbi\OMrun\BuiltInTests\OMrunPlugIn_XmlConverter.exe.config`
