Subject:CSV to XML conversion Author:james streit Date:07 Apr 2006 01:59 PM
We are currently evaluating your product to do a csv file conversion to XML.
I cannot figure out how to get two row element names into the same region.
I need to read one input row and write two different row element names.
Subject:CSV to XML conversion Author:Tony Lavinio Date:07 Apr 2006 02:36 PM
Without seeing your CSV data, it's hard to say exactly, but here are
a few ideas:
1. Regions are used for separating physical parts of the file - say
a fixed-size header from the body. Probably not what you want.
2. If the data lies on differnt rows, you can use the 'match patterns'
to select the rows, and each row matching a pattern can emit a
different set of XML elements.
3. If you need to create more complicated data, the easiest way is to
use XSLT. In fact, you don't even need Convert-to-XML for this, although
you can use it. We'll do two samples here:
3a. Build your Convert-to-XML map as close as you can. Then create an
XSLT transform or XQuery program that takes that .conv and your .csv
file as input and transforms it further. For the input, you'd use
something like this:
3b. If your data really is just plan CSV, you can use the built-in
CSV adapter and pump the data through XSLT or XQUery. In that case,
you'd prefix your file name with 'adapter:CSV?' like this:
Instead of imbuing Convert-to-XML with the capabilities of creating
every possible XML layout, we decided to design it to create the
'XML equivalent' of the input format, and let XSLT and/or XQuery do
what _they're_ really good at.
If you'd like us to take a look at it, you could send a sample of the
.csv and the expected output to email@example.com.
Subject:CSV to XML conversion Author:james streit Date:10 Apr 2006 02:06 PM
Thanks for the reply.
I'm going to attached my input file.
It consists of a header row and patient rows.
I'll also attached the xml file I'm trying to match.
It requires that I have a header row and each inputed patient
row split between two different opening tags underneath
the opening tag <patientleveldata>