XML Schema Definition (XSD) is useful when working with XML schemas that follow the XSD language. With XSD, you can perform the following transformations:
XDR to XSD
XML to XSD
Classes to XSD
XSD to Classes
XSD to DataSet
To convert an XDR-formatted file to XSD, use the following syntax:
xsd [options] file.xdr
Note that the file extension .xdr dictates the conversion from XDR to XSD.
To convert an XML-formatted file to XSD, use the following syntax:
xsd [options] file.xml
Note that the file extension .xml dictates the conversion from XML to XSD.
You can convert classes to XSD by specifying the runtime assembly file (.exe or .dll extension) as the filename to the utility. You can also specify a particular type within the assembly you want to convert to XSD using the /type flag. The typename can be a wildcard match. If you omit the /type flag, all types in the assembly will be converted. The syntax follows:
Xsd [/TYPE:typename] assemblyFile
or:
Xsd [/T:typename] assemblyFile
To convert XSD back to classes, use the /classes or /c flag. You can specify a particular element in the XSD schema to be converted to a class. You can also specify the language for the class source file. The general syntax follows:
xsd /CLASSES /ELEMENT:element /NAMESPACE:namespace /LANGUAGE:language /URI:uri file.xsd
or:
xsd /C E:element /N:namespace /L:language /U:uri file.xsd
Note that namespace, language, and uri can be specified only once.
To convert XSD to dataset, use the /dataset or /d flag. Again, you can narrow down to a particular element in the XSD schema to be converted. The general syntax follows:
xsd /D [/DATASET] file.xsd