Export (0) Print
Expand All

XML Schema Object Model (SOM)

An XML schema is a powerful and complex tool for creating and validating structure in compliant XML documents. Similar to data modeling in a relational database, a schema provides a way to define the structure of XML documents, by specifying the elements that can be used in the documents, as well as the structure and types that these elements must follow in order to be valid for that specific schema.

A schema is an XML file, typically with an .xsd file name extension, that describes the contents of XML documents using valid XML: elements and attributes are declared using element and attribute elements, and structure is created using simpleType and complexType elements.

A schema is an XML document that defines a class of XML documents by specifying the structure or model of XML documents for a particular schema. A schema identifies the constraints on the content of the XML documents, and describes the vocabulary (rules or grammar) that compliant XML documents must follow in order to be considered schema-valid with that particular schema. Validation of an XML document is the process that ensures that the document conforms to the grammar specified by the schema.

Schemas provide the following advancements over document type definitions (DTDs):

  • Additional data types are available using a schema.
  • With a schema you can create custom data types.
  • A schema uses XML syntax.
  • A schema supports object-oriented concepts such as polymorphism and inheritance.

For more information about the objects used within XML schemas, see the XML Schema Reference (XSD).

The Schema Object Model (SOM) provides a set of classes in the System.Xml.Schema namespace that allow you to read a schema from a file or to programmatically create a schema in memory that can be compiled and validated or written to a file.

In This Section

Schema Object Model Overview
Describes the Schema Object Model (SOM) and the features and classes it provides. Also provides a diagram of the SOM hierarchy.
Reading and Writing XML Schema
Provides an example of how to use the SOM to read and write XML Schema definition language (XSD) schemas.
Validation and the Schema Object Model
Describes the situations in which warnings and errors occur during schema validation with the SOM, and provides information about the use of the ValidationEventHandler delegate.
Building and Editing XML Schema
Provides an example of how to traverse the SOM in order to modify an XML Schema.
Post-Schema-Validation Infoset (PSVI)
Describes the information sets that must be exposed before and after validation, and how the SOM represents these infosets.
Deterministic and Non-Deterministic Schemas
Explains how a validation parser determines a sequence for elements in a schema in order to determine validation structure.
Regular Expressions and the Schema Object Model
Explains how to use regular expressions in XML Schema to constrain a value space to values that match a specific regular expression.
Data Type Support between XML Schema (XSD) Types and .NET Framework Types
Shows the mapping between XML Schema data types and their corresponding .NET Framework types.

Related Sections

XML Schema Reference (XSD)
Documents the XML Schema definition language (XSD), as defined by the World Wide Web Consortium (W3C).
Validation of XML with Schemas
Describes the document type definition (DTD), XML-Data Reduced (XDR) schema, and XML Schema definition language (XSD) schema validation available in the .NET Framework.
© 2014 Microsoft