Visual Studio ships with a tool called Xsd.exe that will automatically generate XSD based on an XML file. To use Xsd.exe, you will need to open up a Visual Studio command prompt. Click “Start,” point to “All Programs,” point to “Microsoft Visual Studio 2008,” point to “Visual Studio Tools” and then click “Visual Studio 2008 Command Prompt”. Now type xsd followed by the name of the XML file you want to parse:
This will create a file called planets.xsd.
You can read more here: