Wiki source for CommandCsv2xml

Show raw source

======Command csv2xml======

**csv2xml** converts a csv file to an xml file

csv2xml [ [[SerializationOptions serialization options]] ] [options] [csvfile]

||-root rootname||Use "rootname" as the root element name, default "root"||
||-row rowname|| use "rowname" as each row's element name, default "row"||
||-col colname|| use "colname" as each column's element name (or for attribute normal format, the attribute prefix)||
||-colnames names|| Use a sequence or , separated list of strings to specify the column names||
||-delim delimchar|| deliminate columns with delimchar, default ","||
||-tab ||Use tab char as delimitor. Synonymous for -delim <[ "&#009;" ]>||
||-quote quotechar|| quote with quote character, default "||
||-header || read 1 row from the csv file and use as column names (element or attribute)||
||-attr || Output in attribute normal format (each column is an attribute), default row normal format||
||-skip lines ||Skip # lines before reading header or data ||
||-trim||Trim the output by ignoring any data after the last column specified in -colnames or -header||
||-max #||Combine the data in the last field by ignoring any more delimiters after the # of fields is specifed, or if # is <=0 then use the number of colums||
||csvfile || Name of the csv file to convert, otherwise stdin. Default "-" (stdin)||

Supports the standard [ [[SerializationOptions serialization options]] ]

If -colnames is specified, its argument is taken to be either a sequence of strings, or a single string which is "," seperated which specifieds the column names to be used.
if -header is specified then the first row of the CSV file is read and the values used as column names.
If both -colnames and -header are specified then -colnames takes precedence but the header is still read (and ignored).

The input CSV file is read using the text encoding [[SerializationOptions serialization options]].


echo foo,bar | csv2xml
====Return Value====
Returns 0 if the conversion is successful
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki