Xml Xsd.exe
Jan 16, 2011 - After doing a search, I have found that Visual Studio has a tool named XML Schema Definition Tool (xsd.exe) that can do the trick, and below. I am looking for a tool which will take an XML instance document and output a corresponding XSD schema. I certainly recognize that the generated XSD schema will be limited when compared to creatin. Microsoft has a nifty little tool called xsd.exe which lets you create serializable classes for the.NET framework from an.
Xml Xsd
-->The XML Schema Definition tool (Xsd.exe) allows you to generate an XML schema that describes a class or to generate the class defined by an XML schema. The following procedures show how to perform these operations.
To generate classes that conform to a specific schema
Open a command prompt.
Pass the XML Schema as an argument to the XML Schema Definition tool, which creates a set of classes that are precisely matched to the XML Schema, for example:
The tool can only process schemas that reference the World Wide Web Consortium XML specification of March 16, 2001. In other words, the XML Schema namespace must be 'http://www.w3.org/2001/XMLSchema' as shown in the following example.
Modify the classes with methods, properties, or fields, as necessary. For more information about modifying a class with attributes, see Controlling XML Serialization Using Attributes and Attributes That Control Encoded SOAP Serialization.
It is often useful to examine the schema of the XML stream that is generated when instances of a class (or classes) are serialized. For example, you might publish your schema for others to use, or you might compare it to a schema with which you are trying to achieve conformity.
Xml Xsd Example
To generate an XML Schema document from a set of classes
Compile the class or classes into a DLL.
Open a command prompt.
Pass the DLL as an argument to Xsd.exe, for example:
The schema (or schemas) will be written, beginning with the name 'schema0.xsd'.