Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a csv file that has an attribute column as shown below. The data in that column is the name of the attributes. Some of the attributes could have multiple values. I want to convert this csv into a XML file which will have multivalue tag (listing all values) for the attributes that have more than one value. I know how to convert if there is only single value for each attribute. But I am not sure how to convert the csv to xml when the attributes have single and multivalues. Could somebody please help me with this? Thanks
Input CSV:
Attribute Name, Color
aab, red
abc, red
abc, green
abc, blue
xyz, white
xyz, purple
zyx, green
Expected Output:
<Value AttributeID="aab">red</Value>
<MultiValue AttributeID="abc">
<Value>red</Value>
<Value>green</Value>
<Value>blue</Value>
</MultiValue>
<MultiValue AttributeID="xyz">
<Value>white</Value>
<Value>purple</Value>
</MultiValue>
<Value AttributeID="zyx">green</Value>
Hi
Try this with tFileInputDelimited---> tFileOutputXml
You can group the colors based on attribute name..
I got like this...
Hi Vignesh, thanks for your response.
My requirement is, the output XML has to be in the following format:
<Value AttributeID="aab">red</Value>
<MultiValue AttributeID="abc">
<Value>red</Value>
<Value>green</Value>
<Value>blue</Value>
</MultiValue>
<MultiValue AttributeID="xyz">
<Value>white</Value>
<Value>purple</Value>
</MultiValue>
<Value AttributeID="zyx">green</Value>