-1

Can anyone recommend any Java or .NET library that I can use to ingest a file - which could be in a csv, excel or tab-delimited format - and create an XML file that has a specific schema.

In other words, I don't want to just create an XML file but I need to add additional elements to the file following an XSD file.

I've looked at some of the existing stackoverflow answers and they seem to be creating simple XML files (e.g with an element for each column) rather than ones based on an existing XSD file.

Many Thanks!

joechip
  • 359
  • 5
  • 17
  • “Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, [describe the problem](http://meta.stackexchange.com/q/139399/) and what has been done so far to solve it.” [What topics can I ask about here?](http://stackoverflow.com/help/on-topic) – Anil Jan 25 '14 at 01:04

1 Answers1

0

I would use one of the many, many Java CSV/Excel/Whatever libraries. See these questions for one of those: CSV API for Java , Java library to display Excel data

Then I would suggest using JAXB to turn that into XML. You give JAXB a schema and it generates Objects to represent all of the data in the XSD. Then, you can very easily fill these objects with that data that you got out of the CSV or Excel file and it will produce an XML that is compliant with your schema.

Here's some info on generating the JAXB objects from an XSD. I personally use maven to do that, but assuming you just want to generate the objects once, this should work: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftwbs_jaxbschema2java.html

And here's the tutorial on using JAXB: http://jaxb.java.net/tutorial/

Community
  • 1
  • 1
Jon7
  • 7,165
  • 2
  • 33
  • 39