csv to xml
Oxygen general issues.
-
- Posts: 3
- Joined: Wed Aug 20, 2008 6:42 am
csv to xml
Hi. I need to convert the csv file separated by '|' into a xml file format. May I know how to change the xml name tag?
Input csv file
Person|Name|Carol Lee
Person|Gender|Female
Info|Height|1.68|m
Info|Weight|55|kg
The sample output XML file
<Root>
<Person>
<Name>Carol Lee</Name>
<Gender>Female</Gender>
</Person>
<Info>
<Height>1.68<Height>
<Unit>m</Unit>
<Weight>55</Weight>
<Unit>kg</Unit>
</Info>
</Root>
Input csv file
Person|Name|Carol Lee
Person|Gender|Female
Info|Height|1.68|m
Info|Weight|55|kg
The sample output XML file
<Root>
<Person>
<Name>Carol Lee</Name>
<Gender>Female</Gender>
</Person>
<Info>
<Height>1.68<Height>
<Unit>m</Unit>
<Weight>55</Weight>
<Unit>kg</Unit>
</Info>
</Root>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: csv to xml
Post by sorin_ristache »
Hello,
Oxygen has an import action that can be applied to CSV files and the XML tag names of the result XML file can be configured in the Import Settings panel of the dialog but the text values must be separated by comma, semicolon, tab or space. You cannot generate the XML file that you posted from the input text file that separates the text values with '|'. The XML tags must be specified only once on the first row of the text file instead of once for every text value. For your example the input file should be:
The XML file will be:
and it can be transformed to your final XML format with an XSLT transformation.
Regards,
Sorin
Oxygen has an import action that can be applied to CSV files and the XML tag names of the result XML file can be configured in the Import Settings panel of the dialog but the text values must be separated by comma, semicolon, tab or space. You cannot generate the XML file that you posted from the input text file that separates the text values with '|'. The XML tags must be specified only once on the first row of the text file instead of once for every text value. For your example the input file should be:
Code: Select all
Name, Gender, Height, Unit, Weight, Unit
Carol Lee, Female, 1.68, m, 55, kg
Code: Select all
<root>
<row>
<Name>Carol Lee</Name>
<Gender>Female</Gender>
<Height>1.68</Height>
<Unit>m</Unit>
<Weight>55</Weight>
<Unit>kg</Unit>
</row>
</root>
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service