Mapping XML Schema (XSD) Constraints to DataSet Constraints
The XML Schema definition language (XSD) allows constraints to be specified on the elements and attributes it defines. When mapping an XML Schema to relational schema in a DataSet, XML Schema constraints are mapped to appropriate relational constraints on the tables and columns within the DataSet.
This topic discusses the mapping of the following XML Schema constraints:
- The uniqueness constraint specified using the unique element.
- The key constraint specified using the key element
- The keyref constraint specified using the keyref element.
By using a constraint on an element or attribute, you specify certain restrictions on the values of the element in any instance of the document. For example, a key constraint on a CustomerID child element of a Customer element in the schema indicates that the values of the CustomerID child element must be unique in any document instance and that null values are not allowed.
Constraints can also be specified between elements and attributes in a document, in order to establish a relationship within the document. The key and keyref constraints are used in the schema to specify the constraints within the document, resulting in a relationship between document elements and attributes.
The mapping process converts these schema constraints into appropriate constraints on the tables created within the DataSet.
In This Section
- Mapping unique XML Schema (XSD) Constraints to DataSet Constraints
Describes the XML Schema elements used to create unique constraints in a DataSet. - Mapping key XML Schema (XSD) Constraints to DataSet Constraints
Describes the XML Schema elements used to create key constraints (unique constraints where null values are not allowed) in a DataSet. - Mapping keyref XML Schema (XSD) Constraints to DataSet Constraints
Describes the XML Schema elements used to create keyref (foreign key) constraints in a DataSet.
Related Sections
- Generating DataSet Relational Structure from XML Schema (XSD)
Describes the relational structure, or schema, of a DataSet that is created from XML Schema definition language (XSD) schema. - Generating DataSet Relations from XML Schema (XSD)
Describes the XML Schema elements used to create relations between table columns in a DataSet. - Data Type Support between XML Schema (XSD) Types and .NET Framework Types
Describes how XML Schema types are represented as .NET Framework types for columns in a DataSet.