Convert CSV to XML using an existing XSD
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 1
- Joined: Tue Jun 21, 2011 3:17 pm
Convert CSV to XML using an existing XSD
I am new to oxygen, any help would be appreciated. I have an XSD and a CSV to match. I need to convert the CSV to XML and follow the XSD mappings. Can anyone help get me started or point me to an existing post that would cover this? Thanks.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Convert CSV to XML using an existing XSD
Hello,
Unfortunately Oxygen doesn't provide any automatic means to map the data from a CSV file to an XML document that conforms to an XML schema.
This has to be done manually in two steps:
1. Import the CSV to an XML file
File -> Import -> Text File. Browse for the .csv file and press OK. You will obtain the Import criteria dialog that allows you to choose the field delimiter from the CSV and customize the form of the destination XML file(Change labels).
2.
a) Process the imported XML file either manually or by transforming it with an XSLT stylesheet to conform to the schema.
or
b) Generate a sample XML Instance(Tools -> Generate Sample XML Files) from the XML schema and use the Grid mode(Document -> Edit Mode -> Grid) for both files for transferring the data(copy/paste) from the imported XML to the sample XML instance that's been generated.
You can dock the editors side by side(click and drag an editor tab to the left or to the right side) to follow both files at the same time. Restore them to the default stacked layout by using Window -> Stack Editors
You can find a similar discussion here:
match data to schema
Regards,
Adrian
Unfortunately Oxygen doesn't provide any automatic means to map the data from a CSV file to an XML document that conforms to an XML schema.
This has to be done manually in two steps:
1. Import the CSV to an XML file
File -> Import -> Text File. Browse for the .csv file and press OK. You will obtain the Import criteria dialog that allows you to choose the field delimiter from the CSV and customize the form of the destination XML file(Change labels).
2.
a) Process the imported XML file either manually or by transforming it with an XSLT stylesheet to conform to the schema.
or
b) Generate a sample XML Instance(Tools -> Generate Sample XML Files) from the XML schema and use the Grid mode(Document -> Edit Mode -> Grid) for both files for transferring the data(copy/paste) from the imported XML to the sample XML instance that's been generated.
You can dock the editors side by side(click and drag an editor tab to the left or to the right side) to follow both files at the same time. Restore them to the default stacked layout by using Window -> Stack Editors
You can find a similar discussion here:
match data to schema
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 4
- Joined: Thu Aug 29, 2019 10:46 pm
Using the Import Utility to create XML file
I have a pipe delimited text file that I'm trying to convert to xml.
Using File -> import I'm at the Import criteria window which is showing me the XML Preview:

Do I have to create another XSL sheet to remove the '<Headingx> </Headingx> tags? Or, as in another [url=topic5297.html#p16651/[post/url], would I create an XQuery document to fix this?
I want the document to display like so:
<Batch_ID> ... </Batch_ID>
<Header_Journal_Source>..data here..</Header_Journal_Source>
Will the the Import utility will allow me to manually remove the 'Heading' tags and just keep the tags in between them? I don't see an option to do this, unfortunately.
Any insight would be appreciated.
Thanks,
Vin
Using File -> import I'm at the Import criteria window which is showing me the XML Preview:

Do I have to create another XSL sheet to remove the '<Headingx> </Headingx> tags? Or, as in another [url=topic5297.html#p16651/[post/url], would I create an XQuery document to fix this?
I want the document to display like so:
<Batch_ID> ... </Batch_ID>
<Header_Journal_Source>..data here..</Header_Journal_Source>
Will the the Import utility will allow me to manually remove the 'Heading' tags and just keep the tags in between them? I don't see an option to do this, unfortunately.
Any insight would be appreciated.
Thanks,
Vin
You do not have the required permissions to view the files attached to this post.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Convert CSV to XML using an existing XSD
Hi,
You just have to check the box for "First row contains field names" and it will use the cell values from the first row as element names.
Regards,
Adrian
You just have to check the box for "First row contains field names" and it will use the cell values from the first row as element names.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
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