• 0

CSV to XML Conversion


Question

I've been tasked with converting a CSV file to XML by a colleague, I do not have much experience in this field and I know I more than likely wont have all of the necessary information, but maybe you can help. The file, which I will upload, is a data dictionary  from a program called REDCap. This program is essentially excel on steroids, and is used as a data collection tool at the Hospital I work at. The data dictionary are basically the ID fields from the "database" that is built within the form (this is what captures data from a user). This is the type of data located in the CSV file, headers at the top. My colleague mentioned Altova and mapping the CSV to the XML, but surely looking at this dataset, it is not as complicated as I was originally told and I almost think one of these online converters will do just fine. I have found a few, but I am unsure if there is one that is better than the other? Are there certain standards to be followed when outputting to XML?

xmlcon.PNG

Link to comment
https://www.neowin.net/forum/topic/1377190-csv-to-xml-conversion/
Share on other sites

6 answers to this question

Recommended Posts

  • 0

There are many ways that could be structured as XML. If you've found an online converter that output's something REDCap is happy to absorb then don't worry about it.

 

The only thing I'll mention is that I hope you're not submitting private records to a random online conversion service.

  • 0
2 minutes ago, virtorio said:

There are many ways that could be structured as XML. If you've found an online converter that output's something REDCap is happy to absorb then don't worry about it.

 

The only thing I'll mention is that I hope you're not submitting private records to a random online conversion service.

I appreciate the concern, my REDCap project has no current data, we are still in the stages of finalizing the form for the city. However, the city is who wants the XML file. How this came about is, my colleague was tasked with helping create a digital form, the city used to purchase software to do this but with REDCap being free for non-profits, he figured this would do the trick. The form was created with our own ID's, the city has specific IDs they wanted for other software they use, so we were tasked with recreating the form with the correct IDs, then converting the data dictionary to an XML for them to validate. I have a conference call Wed, to see if they need specific headers or anything, but wanted to be ahead of the game.

  • 0
1 minute ago, Circaflex said:

I appreciate the concern, my REDCap project has no current data, we are still in the stages of finalizing the form for the city. However, the city is who wants the XML file.

Oh yes, sorry I misread that. Anyway, that's the point of XML, is can be structured however you need it to be. Something like this:

<record record_id="xxx" record_id_8736_ce="xxx">
  <date_of_entry>xxx</date_of_entry>
  <country_id>xxx</country_id>
  ...
</record>
<record record_id="xxx" record_id_8736_ce="xxx">
  <date_of_entry>xxx</date_of_entry>
  <country_id>xxx</country_id>
  ...
</record>
<record record_id="xxx" record_id_8736_ce="xxx">
  <date_of_entry>xxx</date_of_entry>
  <country_id>xxx</country_id>
  ...
</record>

Often, you'd put the "unique identifier" of the record as an attribute, and the data in child nodes, like above.

  • 0
2 hours ago, Circaflex said:

converting the data dictionary to an XML for them to validate

"XML" and "Validate" in the same sentence might mean they are looking for an XML Schema file

 

https://en.wikipedia.org/wiki/XML_Schema_(W3C)

 

https://www.w3.org/standards/techs/xmlschema#w3c_all

 

XML is a giant toxic mess and people avoid it like the plague these days, but mostly they use JSON which IMO ends up suffering many of the same issues but at least is not as painful to look at...

 

https://en.wikipedia.org/wiki/JSON

 

https://www.json.org/xml.html

 

 

 

 

 

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.