[Overview] [Operation details] [Sample configuration]
You can use the csvToXml operation to transform a CSV payload in to an XML payload.
Properties
- headerPresent (Header):
Specify whether the CSV input has a header row. This accepts Absent or Present as values. The Default value is Absent. - valueSeparator (Separator):
Specify the separator to use in the CSV input. Default is the,
(comma). To use tab as the separator, use the valuetab
to this property. To use space, use the valuespace
. - skipHeader (Skip Headers): Skip the header row or not in the output CSV.
This property accepts true or false as values. The Default is false. This is available only if the value of theheaderPresent
property is set toPresent
. - columnsToSkip (Skip Columns):
Specify columns to skip from the CSV payload. You can specify the columns as comma-separated values. This property supports more complex queries also, you can find full specifications here. - dataRowsToSkip (Skip Data Rows):
Specify number of data rows to skip. The Default value is 0.- If
headerPresent
isPresent
, then data rows are the rows excluding the first row. - If
headerPresent
isAbsent
, then data rows are the rows starting from the first row.
- If
- Root Element Group:
You can use the properties under this group to config the root XML element of the output XML payload. You can find
the following properties under the root element group.
- rootElementTag (Tag): Name of the XML tag of the root element. The default value is
root
. - rootElementNamespace (Namespace): Namespace of the root element.
- rootElementNamespaceURI (Namespace URI): Namespace URI of the root element.
- rootElementTag (Tag): Name of the XML tag of the root element. The default value is
- Group Element Group
The properties under this group are for configuring the group elements of the output XML payload.
You can find the following properties under the group element group.
- groupElementName (Tag): Name of the XML tag of the group element. The default value is
group
. - groupElementNamespace (Namespace): Namespace of the group element.
- groupElementNamespaceURI (Namespace URI): Namespace URI of the group element.
- groupElementName (Tag): Name of the XML tag of the group element. The default value is
Sample request
Following is a sample CSV request that can be handled by the csvToXml operation.
id,name,email,phone_number
1,De witt Hambidge,dwitt0@newsvine.com,true
2,Brody Dowthwaite,bdowthwaite1@delicious.com,false
3,Catlin Drought,cdrought2@etsy.com,608-510-7991
4,Kissiah Douglass,kdouglass3@squarespace.com,true
5,Robinette Udey,rudey4@nytimes.com,true
Sample Configuration
Given below is a sample configuration for the csvToXml operation.
<CSV.csvToXml>
<headerPresent>Present</headerPresent>
<skipHeader>true</skipHeader>
<columnsToSkip>"phone_number"</columnsToSkip>
<tagNames>index,name,email</tagNames>
<rootElementTag>results</rootElementTag>
<groupElementTag>result</groupElementTag>
</CSV.csvToXml>
Sample response
Following is a sample response from the operation.
<results>
<result>
<index>1</index>
<name>De witt Hambidge</name>
<email>dwitt0@newsvine.com</email>
</result>
<result>
<index>2</index>
<name>Brody Dowthwaite</name>
<email>bdowthwaite1@delicious.com</email>
</result>
<result>
<index>3</index>
<name>Catlin Drought</name>
<email>cdrought2@etsy.com</email>
</result>
<result>
<index>4</index>
<name>Kissiah Douglass</name>
<email>kdouglass3@squarespace.com</email>
</result>
<result>
<index>5</index>
<name>Robinette Udey</name>
<email>rudey4@nytimes.com</email>
</result>
</results>