This documentation is archived and is not being maintained.

Creating XML Schemas and Datasets

Visual Studio .NET 2003

ADO.NET typed datasets are classes that are generated from XML Schemas (.xsd file). As changes are made to the schema file the definition of the dataset class changes as well. When working with XML Schemas and typed dataset representations in Visual Studio at design time there is essentially no difference. They are both .xsd files in the XML Designer, the difference being that typed datasets have an associated class file and a predefined document (or root) node that represents the encompassing dataset.

A schema serves these functions:

  • It describes the "shape" of the XML document — for example, whether the XML document is constructed hierarchically or in a keyed relationship.
  • It validates data being imported from an XML stream or document into a dataset.
  • It establishes the relational structure of the dataset's tables and columns, the key columns, constraints, relationships between tables, and so on; the information is used when generating a DataSet Class. In this respect, the schema serves a special role that requires it to support dataset-specific features.

For more information, see Introduction to Datasets.

In This Section

Relationship Between XML Schemas and Datasets
Provides an overview of how schemas are used to define datasets, as well as links to more dataset information.
Creating XML Schemas: High-Level Process
Provides an overview of the process of defining an XML Schema, including links to the various steps involved.
Adding New Schemas
Describes how to add new XML Schemas and Datasets to a project and what actual files are included with each option.
Creating XML Schemas and Datasets from Existing Data
Describes how to define an XML Schema based on data that can be accessed through Server Explorer.
Creating New Typed Datasets with the XML Designer
Details the steps involved when creating a schema that will represent relational data.
Creating ADO.NET Typed DataSets from Schemas
Describes how to use the XML Designer to generate typed datasets from existing XML Schemas.
Importing External Elements into XML Schemas
Describes how to add references to other schemas in order to use globally declared data types from other schemas.
XML Namespaces
Provides an overview of how namespaces are used in XML Schemas.
Changing the Target Namespace
Explains how the XML Designer provides a default namespace value, and the steps involved in adding a valid namespace Uniform Resource Identifier (URI) to your schema.
Walkthrough: Creating an XML Schema with the XML Designer
Provides step-by-step instructions for how to create an XML Schema that represents a purchase order.
Walkthrough: Reading XML Data into a Dataset
Shows how to load XML data into a dataset, display it in a Windows Forms DataGrid control, then display an XML Schema for the XML file in a text box.

Related Sections

XML Schemas and Data
Introduces topics and sections that describe how to use the XML Designer to work with XML Schemas and datasets.
XML Schemas and the XML Designer
Introduces topics that describe the different elements in XML Schemas and how they are created using the XML Designer.
Relational Data in XML Schemas
Introduces topics that describe the different options in XML Schemas for representing relational data.
XML Files
Introduces topics that explain how to use the XML Designer when working with XML documents.
DataSet Class
Provides information on datasets.
Introduction to Data Access with ADO.NET
Provides a high level overview of the most important concepts of data access in ADO.NET.
Introduction to Datasets
Provides an overview of what ADO.NET datasets are, how they can be typed or untyped, what they are used for, and how they are structured.
XML in Visual Studio
Provides links to a variety of topics about XML.
World Wide Web Consortium (W3C) Web site (
Links to the XML Schema primer and other XML info posted by the W3C.
XML Developer Center on MSDN Online (
Provides various resources about XML.
XML Schema Reference (XSD)
Provides reference topics for schema elements and data types.
XML Designer
Provides an overview of the XML Design tool in Visual Studio.