XML Schemas play an important role in the .NET platform including being an integral part of Web Services, ADO.NET, and XML document validation. Although you can use features found in the DataSet class to create schemas from XML documents, .NET also allows custom schemas to be created.
The XML Schema generator shown in this sample application demonstrates how different classes within the System.Xml.Schema namespace can be used to create an XML schema document from scratch. Although the generator provides nice features such as controlling the type of output generated (Russian Doll style or Separate Complex Types), detecting basic data types, handling recurring elements, etc. it is by no means as full-featured as schema features found in the DataSet class. For example, it does not currently handle namespaces in the XML document. After using the XML Schema Generator to generate a schema, you may need to perform minor modifications to use it to validate your XML document.
A tool that generates schemas from XML documents using DataSet schema features can be found here.