Tuesday, August 11, 2009

Generate XSD from XML

B2B340C5-1804-4A18-9ACE-A8D668EBE7AE.jpg

I'm working on a project that requires me to provide an XSD file to validate the XML files I'll be sending from a laboratory to a hospital. Using the W3 Schools tutorials on XML and XSD I started writing my XSD by hand. I do NOT encourage this, it's a pretty painful experience and I was quickly frustrated.

A few Google searches later lead me to Trang, which is a Java utility to generate an XSD file from an XML file, that will run on Windows, Mac OS X and Linux. While not perfect (kept missing the date type no matter what I did), it provided a good skeleton that I could then "tweak" the element types to be correct.

No comments: