ObjCSV_Collection2XML()

Builds an XML file from the content of the collection. The calling script must ensure that field names and field data comply with the rules of XML syntax. This simple example, where each record has two fields named "Field1" and "Field2", shows the XML output format:

<?xml version='1.0'?>
<XMLExport>
  <Record>
    <Field1>Value Row 1 Col 1</Field1>
    <Field2>Value Row 1 Col 2</Field1>
  </Record>
  <Record>
    <Field1>Value Row 2 Col 1</Field1>
    <Field2>Value Row 2 Col 2</Field1>
  </Record>
</XMLExport>
ObjCSV_Collection2XML(objCollection, strFilePath [, intProgressType = 0, blnOverwrite = 0, strProgressText = "", strFileEncoding := ""])

Parameters

objCollection Object containing an array of objects (or collection). Objects in the collection are associative arrays which contain a list key-value pairs. See ObjCSV_CSV2Collection returned value for details.
strFilePath The name of the XML file, which is assumed to be in %A_WorkingDir% if an absolute path isn't specified.
intProgressType (Optional) If 1, a progress bar is displayed. If -1, -2 or -n, the part "n" of the status bar is updated with the progress in percentage. See also strProgressText below. By default, no progress bar or status (0).
blnOverwrite (Optional) If true (or 1), overwrite existing files. If false (or 0) and the output file exists, the function ends without writing the output file. False (or 0) by default.
strProgressText (Optional) Text to display in the progress bar or in the status bar. For status bar progress, the string "##" is replaced with the percentage of progress. See also intProgressType above. Empty by default.
strFileEncoding (Optional) File encoding: ANSI, UTF-8, UTF-16, UTF-8-RAW, UTF-16-RAW or CPnnnn (a code page with numeric identifier nnn - see https://autohotkey.com/docs/commands/FileEncoding.htm). Empty by default (system default ANSI code page).

Returns

At the end of execution, the function sets ErrorLevel to: 0 No error / 1 File system error / 2 File exists and should not be overwritten. For system errors, check A_LastError and google "windows system error codes".