Skip to content

How To Generate XSD from XML / Convert XML to XSD

May 27, 2010

I had to complete a project that involved working with a web service. Problem was, I had the XML files, but needed the XML Schema Definition (XSD) schemas, and coming up with them manually would have been too tedious and would have took too much time. So I went online, and found 2 reliable methods. Oh, and they are free!

Generate XSD from XML Tool

The first is Trang. You can get it here from the official Trang site, or here where I’ve had it mirrored: Download Trang

Using it is simple: Just extract it, then go to your command-line, and run it against any XML document that you may have. Trang is written in Java, so it’s cross-platform and compatible with any platform that can run the Java Virtual Machine. To use it, just use it in this syntax:

trang.jar <your XML> <your desired XSD>

An example:

trang.jar YourDocument.xml YourSchema.xsd

Viola! You’ll find your XSD automatically generated!

Generate XSD from XML Online

If you don’t want to go through Trang, you can use an online tool. The only online XML to XSD tool that I found was this one: Generate XSD from XML Online

It’s pretty good too, and can give you a quick XSD from your XML document.

Best XML Book for Beginners

If you’re interested in XML and want to learn more about it, I highly recommend this XML book: XML: Visual QuickStart Guide

Have fun! 😀

Related Posts.