On this Page

    _parser.delimitedToXml

    Delimited data to an XML file.

    Syntax

    _parser.delimitedToXml(fromfiletofilenames[, delimiter[, quote[, trim]]])

    Parameters

    fromfile existing file containing delimited records.

    tofile name of a new file that will get created with the XML equivalent of the fromfile.

    names is an array of field names. The record is assumed to have these fields in it in this order. This allows the resulting output to be treated like an array of parsed values. If any individual names array element is set to null rather than a field name, the corresponding data field is excluded from the output, i.e. the field is ignored. If a names parameter is set to null the fields will instead be named 0, 1, ... sequentially.

    delimiter is optional and defaults to ',' (a comma). Set this to '\t' for tab-delimited data records or ' ' for blank-delimited files.

    quote character is optional and defaults to the double-quote character. This is the type of quotation character that surrounds strings in the data stream. You might want to set to "'" to use single-quotes.

    trim parameter is optional (defaults to false). If present and set to true, returned values will have leading as well as trailing  blanks removed.

    Returned Value

    A return value of zero indicates a successful conversion. Other possible error return codes:

    • -904 - could not open the fromfile.
    • -905 - could not open the tofile.
    • -906 - a conversion error occurred converting one of the data records.

    Description

    This routine is used to convert an entire delimited file into XML. Each line of data in the source fromfile is considered a single record in the output tofile and will be surrounded by a <document> ... </document> XML structure.

    See Also

    _parser.delimited
    _parser.fixed
    _parser.fixedToXml
    _parser.parms