This documentation is archived and is not being maintained.

How to: Create One-to-Many Relationships in XML Schemas and Datasets (XML Designer) 


In versions prior to Visual Studio 2005, the XML Designer is the designer for typed datasets and XML schema. The XML Designer can still be used to create and edit XML schema files. However, in the current version, the designer for creating and editing typed datasets is the Dataset Designer. For more information, see Dataset Designer.

This page assumes you are working with the XML Designer. To open a typed dataset file with the XML Designer, right-click the file in Solution Explorer, point to Open With, and then click XML Schema Editor.

You create a schema with one-to-many relationships when XML files contain related elements that are hierarchically at the same level.

There are three main steps involved in creating an XML Schema that will be used to validate data that is structured in a one-to-many relationship.

To create a schema that represents a one-to-many relationship

  1. Create the tables that will represent your applications data structure.

  2. Create the primary keys, unique keys, and keyrefs.

  3. Create the relationships between the tables.

    For instructions on See

    Constructing Tables

    Creating Tables in XML Schemas

    Defining Keys

    Creating Primary and Unique Keys in XML Schemas

    Defining Relationships (keyrefs)

    Creating DataRelation Objects with the XML Designer

See Also