NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

NGWS Runtime XML Schema Definition Tool (xsd.exe)

XSD is a tool that is useful when working with XML Schemas that follow the XML Schema Definition (XSD) language proposed by the W3C. XSD can perform the following operations:

For more information on XML Schema Definition proposal or the XML standard, see http://w3.org.

Syntax

Generic arguments to xsd.

Argument Description
/? or /H[ELP] Print help for the tool.
/O[UTPUTDIR]:directory Specify the directory in which to place output files. This argument can appear only once.
xsd [options] file.xdr

If you specify an XDR Schema file (.xdr extension), XDR will convert the XDR schema to be an XSD schema. The output file will have the same name as the XDR schema, but will have an the extension .xsd.

xsd [options] file.XML

If you specify an XML file (.XML extension), XDR will “infer” a schema from the data in the file an produce an XSD schema. The output file will have the same name as the XML file, but will have an the extension .xsd.

xsd [options] file.xsd

If you specify an XML Schema file (.xsd extension), XSD will generate source code for NGWS runtime objects that correspond to the XML schema.

One (and only one) of the following options must be specified for .xsd files:

Argument Description
/D[ATASET] Generate a subclass of DataSet which corresponds to the specified schema. To read XML data into the subclass, use the System.Data.DataSet.ReadXMLData method.
/C[LASSES] Generate classes corresponding to the specified schema. To read XML data into the object, use the System.XML.Serialization.XMLSerializer.Deserializer method.

The following options are optional:

Argument Description
/E[LEMENT]:element Specify the element in the schema to generate code for. By default all elements are typed. This argument can appear more than once.
/L[ANGUAGE]:language Specify the programming language to use. Choose from C# or VB. This argument can appear only once.
/N[AMESPACE]:namespace Specify the NGWS runtime namespace for the generated types. This argument can appear only once.
/U[RI]:uri Specify the uri for the elements in the schema to generate code for. This uri, if present, applies to all elements passed in. This argument can appear only once.

The default language is VB. The default namespace is “Schemas”.

xsd [options] file.dll

If you specify a NGWS Runtime Assembly file (.exe, or .dll extension), XSD will generate schema(s) for one or more types in that assembly. The /TYPE option can used to specify which type(s) to generate schemas for. If /TYPE is not specified, then schema(s) will be generated for all types in the assembly. The output schema(s) are named schema0.xsd, schema1.xsd, etc. There will only be more than one schema output if the types specified have specified a namespace using the XMLRoot custom attribute.

Argument Description
/T[YPE]:typename Specifies the name of the type in the assembly that a schema should be created for. If the typename does not specify a namespace, which will match all types in the assembly with that type name. If the typename does specify a namespace, then only that type will match. If the typename ends with a * character, then all types that start with the string preceeding the * will be matched. This argument can appear more than once.

See Also

WebServiceUtil