Microsoft XML SDK 2.6 - XML Developer's Guide

XML Schemas and Namespaces

Msxml enables XML Schemas to be referenced directly from a namespace declaration. This allows the XML parser to validate the XML against the grammar defined in the schema. It also allows the object model to expose data types and to allow navigation to the schema document through the definition property (see XML Schemas and the DOM).

A namespace declaration can reference a schema by including the URL to the schema document prefaced by the "x-schema:" string. For example, to reference an XML Schema for books from an XML file conforming to this schema, you would write:

<book xmlns="x-schema:http://www.microsoft.com/xml/schema/book.xml">
  <title>Presenting XML</title>
  <author>Richard Light</author>
  <pages>334</pages>
</book>

Here the default namespace refers to the sample book grammar used in the Defining Elements and Attributes section. The namespace Universal Resource Identifier (URI) is prefixed with "x-schema:" to indicate to the XML parser that there is a schema corresponding to this namespace. The remainder of the URI is the schema's location. The path or URI to the schema file must be valid, or a parse error will occur.