Create XML schema from XML file

Suppose you want to create a xsd based on an "example.xml" structure. After download and extract trang you can run it with: java -jar /trang.jar example.xml example.xsd The "example.xsd" file generated may not be exactly what you need, but most of the time it is a good starting point. To validate a xml file, for instance "example.xml", against an xsd file, "example.xsd", you can use the following command: xmllint --schema form.xsd ~/form.xml