If i have a complex XML file, is there a cheap or free way to get a rough approximation of an XSD from it?
-
This has been asked before. See http://stackoverflow.com/questions/74879/any-tools-to-generate-an-xsd-schema-from-an-xml-instance-document for a complete list. – studgeek Apr 11 '13 at 20:46
-
I used this tool to create XSD file from xml : http://www.whiterocksoftware.com/2019/04/xsd-from-xml.html It's not command line and have basic UI. – Pomodoro Technique Game Jun 10 '19 at 15:59
4 Answers
A good xml to xsd converter is Trang. It is a command line tool that is very small and does the trick. It can be found on kam's blog - http://www.dotkam.com/2008/05/28/generate-xsd-from-xml/

- 46
- 1
- 5
If you use Visual Studio, it includes a console program called xsd.exe that can automatically generate schemas from xml.
It also can automatically generate classes or datasets from schemas.

- 399,467
- 113
- 570
- 794
Yes. There are tools that can analyse your XML and provide an XSD. For example, Visual Studio 2005 and 2008 include a Create XSD command from within the IDE as well as a command line tool, xsd.exe, that will do this.
However, note that it can only deduce the XSD from your provided XML, so the XSD may only validate that one file correctly. Once you've created your XSD, you should consider refactoring it against other XML files to ensure it properly fits the format you want to validate.

- 61,417
- 20
- 137
- 189
XmlSpy also has this feature. If it's better than VS i don't know. But for working with xml and xsds I prefer et over VS any day

- 2,783
- 2
- 33
- 43
-
XmlSpy is good, but if you've already paid for VS it can be hard to convince the powers that be to invest more money. – Jeff Yates Oct 07 '08 at 15:26
-