This repository is archived and tasks are moved to https://github.com/CommunityHiQ/Frends.Community.Xml
FRENDS Task to convert XML to CSV. XML needs to represent a table, othervice conversion fails.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
Property | Type | Description | Example |
---|---|---|---|
InputData | string | XML string to be converted into csv. | See bellow. |
CsvSeparator | string | Separator for the output columns. | ; |
IncludeHeaders | bool | True if the column headers should be included into the output | true |
Example input:
<root>
<row id='1'>
<name>Google</name>
<url>https://en.wikipedia.org/wiki/Google</url>
<fancy_characters>comma (,) inside field</fancy_characters>
</row>
<row id='2'>
<name>Apple</name>
<url>https://en.wikipedia.org/wiki/Apple_Inc.</url>
<fancy_characters>Kanji 漢字</fancy_characters>
</row>
<row id='3'>
<name>Missing columns</name>
</row>
</root>
Property | Type | Description | Example |
---|---|---|---|
Result | string | Result as CSV | See bellow. |
Example output, for input given above, with comma as a delimeter and headers included:
name,url,fancy_characters,id
Google,https://en.wikipedia.org/wiki/Google,"comma (,) inside field",1
Apple,https://en.wikipedia.org/wiki/Apple_Inc.,Kanji 漢字,2
Missing columns,,,3
If input XML string contains multiple fields with same name, they are omited. Also rows must be in element with same name. If id is not given for row as a attribute filed named rowname_Id is added, with row number.
For example, following XML:
<table>
<foo>
<bar>700</bar>
<foobar>12</foobar>
</foo>
<foo>
<bar>800</bar>
<bar>800</bar>
<foobar>5</foobar>
</foo>
<invalid>
<bar>200</bar>
<foobar>7</foobar>
</invalid>
</table>
is thus converted to, using comma as a delimeter and headers included:
foo_Id,foobar
0,12
1,5
This project is licensed under the MIT License - see the LICENSE file for details
Version | Changes |
---|---|
2.0.0 | Task renamed (old name was ConvertToCsv). New task can only convert XML to CSV. Csv.Create should be used to convert JSOn to CSV. |
2.1.0 | Multitarget support. Everything in namespaces etc. is now renamed to ConvertXmlToCsv. |