Improvements in Schema Cache Behavior in MSXML 6.0
Collapse the table of content
Expand the table of content

Improvements in Schema Cache Behavior in MSXML 6.0


A number of changes and improvements have been made to the schema cache in MSXML 6.0.

There are significant differences between MSXML 5.0 and MSXML 6.0 regarding adding schemas to the schema cache.

In MSXML 5.0 and before, when you add a schema, imported schemas were added into the same "top-level" schema in the schema cache, even if they had a different namespace. If you called the getSchema method, you received an ISchema interface object that contained definitions for the schema that you added, as well as all schemas that were imported.

In MSXML 6.0, when you add a schema, imported schemas with different target namespaces are added as their own "top-level" schema, with their own namespace. This means that after adding a schema that imports schemas with other target namespaces, if you want to see the definitions for all types in all namespaces, you have to call the getSchema method separately for each namespace.

When a schema (or imported schema) is added to the cache and an existing schema has the same target namespace, the two schemas are merged. If there are conflicts between types in the two schemas, MSXML 6.0 throws an exception.

This is sometimes called adding "partial" schemas. You can construct a schema cache from several schema documents, all having the same target namespace. All of the schemas are merged into the same namespace.

Any namespace or type already added to the schema cache can be referenced by another schema in the cache even if there is no explicit import in the referencing schema. You need to set validateOnLoad Property to false to avoid issues around the order of calls to this method.

When schemas are added to the schema cache, either by the add method (IXMLDOMSchemaCollection/XMLSchemaCache) or by the addCollection method, all of the schemas (including imported schemas) are added to the cache, or none of them are.

A schema for schemas can be added to the schema cache. This allows you to validate schemas before using the schemas to validate documents.

MSXML 6.0 has removed support for XDR schemas, whereas XDR is supported in MSXML 3.0 and MSXML 4.0. XDR schemas can no longer be added to the schema cache.

© 2016 Microsoft