5.4 Generating XML Schemas and Strongly Typed DataSets with XSD.exe

The .NET Framework SDK includes a tool named XSD.exe that can be used to speed up development when going from XML to code and from code to XML. The tool can automatically generate XML Schema Definition (XSD) files from XML or from classes and can also be used to generate strongly typed DataSets.

Tip

XSD is a W3C recommendation that defines a format for specifying the structure, semantics, and content of an XML file.

We’ll look at how to use XSD.exe to accomplish both of these tasks in this article.

XSD.exe at a Glance

Tool

XSD.exe

Version covered

2.0 (.NET SDK)

Home page

http://msdn2.microsoft.com/en-us/library/x6c1kb0s.aspx

Power Tools page

http://www.windevpowertools.com/tools/1

Summary

Quickly and easily generate classes from schema and/or generate schema from classes

License type

Microsoft EULA

Online resources

Forums

Supported Frameworks

.NET 1.1, 2.0

Related tools in this book

WSCF, XSDObjectGenerator

Getting Started

XSD.exe is part of the .NET Framework, so you don’t need to do anything other than install a version of the .NET SDK to use it.

Using XSD

If you peek under the covers of a DataSet, you will find XML. This means that using XSD files as the basis for your data (and, more importantly, its structure) makes the creation of strongly typed DataSet objects rather simple. The best and easiest way to accomplish this is by first creating ...

Get Windows Developer Power Tools now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.