다음을 통해 공유


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

  • 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.