Article ID: 313826 - Last Review: February 20, 2007 - Revision: 5.5 INFO: Roadmap for XML Schemas in the .NET FrameworkThis article was previously published under Q313826 On This PageSUMMARY
This article provides a roadmap to learn about the .NET Framework implementation and support for Extensible Markup Language (XML) schemas. Roadmap articles provide links to useful information, including online documentation, Microsoft Knowledge Base articles, and Microsoft white papers, to help you learn about a Microsoft product or technology. OverviewXML schemas define the structures of XML documents. The structure of an XML document is made up of the name, the cardinality, the data types, and the order of the elements and the attributes of the XML document. XML schemas use XML-based syntax to define XML document structures. XML schemas are frequently used to validate the contents of XML documents to make sure that they follow defined structures.The XML Schema Definition Language (XSD) is the current World Wide Web Consortium (W3C) specification for XML schemas. XSD is an industry standard that is used to create XML schemas. For more information about XML schemas in general, see the following W3C tutorial:
XML Schema Part 0: Primer
For more information about the W3C specifications for the XSD schema structures and data types, see the following W3C Web sites:
http://www.w3.org/TR/2000/WD-xmlschema-0-20000922/ (http://www.w3.org/TR/2000/WD-xmlschema-0-20000922/)
XML Schema Part 1: Structures
The .NET Framework implements full support for XML schemas in accordance with the W3C XML schema specifications for structures and for data types. The System.Xml.Schema .NET Framework namespace implements the .NET Framework classes that collectively implement support for the XML Schema Object Model (SOM).http://www.w3.org/TR/xmlschema-1/ (http://www.w3.org/TR/xmlschema-1/) XML Schema Part 2: Datatypes http://www.w3.org/TR/xmlschema-2/ (http://www.w3.org/TR/xmlschema-2/) For more information about the System.Xml.Schema namespace, see the following MSDN Web site:
System.Xml.Schema Namespace
For an overview of the XML Schema Object Model in the .NET Framework, see the following MSDN Web site:
http://msdn.microsoft.com/en-us/library/system.xml.schema.aspx (http://msdn.microsoft.com/en-us/library/system.xml.schema.aspx)
Schema Object Model Overview http://msdn.microsoft.com/en-us/library/bs8hh90b(VS.71).aspx (http://msdn.microsoft.com/en-us/library/bs8hh90b(VS.71).aspx) Key Concepts and QuickStart TutorialsThis section includes documentation about key concepts of XML schemas. Additionally, this section includes references to QuickStart tutorials for more information about the commonly used classes in the System.Xml.Schema namespace.
Data Type Support between XML Schema (XSD) Types and .NET Framework Types http://msdn.microsoft.com/en-us/library/aa719879(VS.71).aspx (http://msdn.microsoft.com/en-us/library/aa719879(VS.71).aspx) Deterministic and Non-Deterministic Schemas http://msdn.microsoft.com/en-us/library/9bf3997x(VS.71).aspx (http://msdn.microsoft.com/en-us/library/9bf3997x(VS.71).aspx) How Do I...Read and Write a Schema? http://samples.gotdotnet.com/quickstart/howto/doc/Xml/XmlReadWriteSchema.aspx (http://samples.gotdotnet.com/quickstart/howto/doc/Xml/XmlReadWriteSchema.aspx) How Do I...use the Schema Object Model? http://samples.gotdotnet.com/quickstart/howto/doc/Xml/XmlSchemaObjectModel.aspx (http://samples.gotdotnet.com/quickstart/howto/doc/Xml/XmlSchemaObjectModel.aspx) How Do I...Use XML Schema Collection? http://samples.gotdotnet.com/quickstart/howto/doc/Xml/SchemaCollection.aspx (http://samples.gotdotnet.com/quickstart/howto/doc/Xml/SchemaCollection.aspx) System.Xml.Schema NamespaceThe classes in the System.Xml.Schema .NET Framework namespace collectively implement a Schema Object Model (SOM) that complies with the Wide Web Consortium (W3C) XML Schema recommendation. You can use these classes to read a schema from a file or to programmatically generate and compile a schema that can then be persisted to a file on disk.The SOM is made up of classes (for example, XmlSchema, XmlSchemaElement, and XmlSchemaComplexType) that correspond directly to the XSD structures (xsd:schema, xsd:element, and xsd:complexType) that are defined in the W3C specifications. The following classes are frequently-used SOM classes that are implemented in the System.Xml.Schema namespace:
Microsoft Knowledge Base ArticlesProgrammatically Create XML Schema DefinitionThe .NET Framework provides various classes to programmatically generate XML schemas.For more information about how to generate an XSD schema, see the following MSDN Web site:
XmlSchema Class For additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
http://msdn.microsoft.com/en-us/library/system.xml.schema.xmlschema(VS.71).aspx (http://msdn.microsoft.com/en-us/library/system.xml.schema.xmlschema(VS.71).aspx) 317903
(http://support.microsoft.com/kb/317903/EN-US/
)
HOW TO: Modify an XML Schema by Using System.Xml.Schema Classes in Visual Basic .NET
Programmatically Create XSD Schema from a DatabaseThe .NET Framework System.Data namespace includes the DataSet class. DataSet can load both relational and hierarchical data. By using the DataSet class, schema from a database can be retrieved and written as XSD schema.For additional information, click the article number below to view the article in the Microsoft Knowledge Base: 317940
(http://support.microsoft.com/kb/317940/EN-US/
)
HOW TO: Write an XSD Schema from a Database by Using a DataSet
Handle XmlValidatingReader ErrorsTo handle errors that the XmlValidatingReader class detects as it traverses the XML document, you must declare the ValidationEventHandler delegate.Validate XML Data Against XML SchemasThe XmlValidatingReader class provides support for data validation. You can use this class to validate the XML data in all types of XML schemas: XML Schema Definition Language (XSD) schema, XML-Data Reduced (XDR) schema, and Document Type Definition (DTD). You can use the Schemas property to validate the reader by using schema files that are cached in an XmlSchemaCollection object. The ValidationType property specifies what type of validation the reader performs. If you set the property to ValidationType.None, you create a non-validating reader.For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base: 307379
(http://support.microsoft.com/kb/307379/EN-US/
)
HOW TO: Validate an XML Document by Using DTD, XDR, or XSD in Visual C# .NET
317463
(http://support.microsoft.com/kb/317463/EN-US/
)
HOW TO: Validate XML Fragments Against an XML Schema in Visual Basic .NET
Cache SchemasThe XmlSchemaCollection class contains a cache of XML Schema Definition Language (XSD) and XML-Data Reduced (XDR) schemas. Schemas are loaded by using the Add method, at which time the schema is associated with a namespace uniform resource identifier (URI). For XSD schemas, this is typically the targetNamespace property of the schema. Although XmlSchemaCollection stores both XSD schemas and XDR schemas, any method and property that takes or returns an XmlSchema object applies to XSD schemas only.For additional information, click the article number below to view the article in the Microsoft Knowledge Base: 317595
(http://support.microsoft.com/kb/317595/EN-US/
)
HOW TO: Validate an XML Document by Using Multiple Schemas in Visual Basic .NET
Create a Key Element by Using the XmlSchemaKey ClassThe XmlSchemaKey class identifies a key constraint. This class represents the World Wide Web Consortium (W3C) key element.317688
(http://support.microsoft.com/kb/317688/EN-US/
)
HOW TO: Create a Key Element for an XML Schema
Guidelines
TroubleshootingIf you experience problems, or if you have questions, you can refer to the MSDN newsgroups where you can share your experiences with your peers. You can also use the Microsoft Knowledge Base to search for articles about specific issues.
MSDN Newsgroups http://msdn.microsoft.com/newsgroups/ (http://msdn.microsoft.com/newsgroups/) Searching the Knowledge Base http://support.microsoft.com/search (http://support.microsoft.com/search) REFERENCESFor additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
313651
(http://support.microsoft.com/kb/313651/EN-US/
)
INFO: Roadmap for XML in the .NET Framework
| Article Translations
|
Back to the top
