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 :
300
Learn XSD Schemas .NET Tutorial
In real world applications, manually creating classes for each XML type
your application handles can be a tedious job, especially when you are
dealing with very large schemas. Luckily, we don’t have to create the
classes by hand when we have an XML schema describing the data format. The
.NET Framework supplies a command line tool called XML Schema Definition
Tool (xsd.exe) to produce C#, VB.NET or JScript classes for types defined in
XSD schemas and vice versa. The tool will also perform a number of other XML
related conversions that come handy during development work. Table C.1 lists
the different options and their invocation syntax.
Let’s think about this for a moment before we continue to explore the
functionality of the XML Schema definition tool. You can take any .NET
assembly – your own as well as third party – and extract the type
information into an XSD schema. That is something that was not possible
before on the Microsoft platform. Before .NET, native Win32 DLLs and EXEs
only contained the executable code and binary data structures. COM
type-libraries contained some metadata about classes and their interfaces,
but developers had to create them explicitly. .NET assemblies on the other
hand contain complete metadata about all classes inside: class names,
function names, parameter names, types of local variables, everything. The
.NET Framework exposes this metadata to developers through the classes in
the System.Reflection namespace. The XSD tool uses these classes to analyze
assemblies and then creates schemas with the classes in System.Xml.Schema.
All other conversions are also done entirely using classes provided by the
.NET Framework. The XSD command-line application itself only “glues”
these classes together.