Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
393
Convert XDR to XSD
In addition to generating classes from schema, the tool performs a number of
other XML-related conversions that come in handy during development work. Table
C.1 lists all the different options and their invocation syntax.
1.1 Table
C.1 Syntax of the xsd tool. The tool will identify the input file by the
extension. Each conversion option offers command line options to customize the
output.
Conversion Option
Call syntax
Convert an XDR schema to XSD format.
xsd file.xdr [/o:directory]
Derive an XML schema from an XML document.
xsd file.xml [/o:directory]
Generate classes from an XSD schema. If a schema includes or imports
other schemas you have to explicitly specify on the command line as well.
The tool does not follow the schemaLocation hint.
xsd file1.xsd file2.xsd … /c
[/e:element]
[/l:language]
[/n:namespace]
[/o:directory]
[/u:uri]
Generate a strongly-typed DataSet from an XSD schema.
xsd file1.xsd file2.xsd … /d
[/l:language]
[/n:namespace]
[/o:directory]
Generate a schema from classes in a compiled assembly.
xsd {file.dll | file.exe}
[/o:directory]
[/t:typename [...]]
XSD command line options
We can customize each conversion the tool performs through a number of
command-line options. For example, you can select which classes you want to
export from a schema. Table C.2 gives a complete overview of the available
options.
1.2 Table
C.2 Command line options of the XSD Schema Definition Tool. The options select
item to export from the input file and customize the output of the tool.
Option
Description
/h[elp] or /?
Displays help about the command syntax and the available options to
customize the behavior of the tool.
/o[utputdir]:directory
Specifies the output directory for the generated files.
/c[lasses]
Specifies to create .NET classes for use with the XmlSerializer from
the specified schema. The output can be further customized with the /e,
/u, /n and /l options.
/d[ataset]
Specifies to create a typed DataSet class from the specified schema.
The output can be further customized with the /n and /l options.
/e[lement]:element
Selects a top-level element in the schema for which to generate code.
Multiple /e options can be used to select multiple elements.
/l[anguage]:language
Specifies the programming language for the generated classes. Possible
options are: ‘CS’ for C#, ‘VB’ for Visual Basic.NET and ‘JS’
for Jscript. If no language is specified the tool produces output in C#.
The /l option can also identify the fully qualified name for a
CodeDomProvider of a different language.
/n[amespace]:namespace
Specifies the .NET namespace for the generated classes.
/u[ri]:uri
Selects top-level elements from the specified namespace. A /u parameter
can be combined with a /e parameter.
/t[ype]:typename
Selects types from an assembly to include in the generated schema.
Multiple /t option can be supplied to select multiple types. The
typename may be qualified with a .NET namespace. If no namespace
is specified the tool will include elements for all classes matching typename.
The option can also specify a wildcard pattern if typename ends
with an asterisk character (*) to select a number of classes.