Additional Notes - adojos/vbsx-Validator GitHub Wiki
Referencing XSD Schemas in Documents
To reference an XML Schema (XSD) schema from an XML document in MSXML 6.0, you can use any one of the following means to link a schema to an XML document so that MSXML will use the schema to validate the document contents.
-
Reference the XSD schema in the XML document using XML schema instance attributes such as either xsi:schemaLocation or xsi:noNamespaceSchemaLocation.
-
Add the XSD schema file to a schema cache and then connect that cache to the DOM document or SAX reader, prior to loading or parsing the XML document.
The 'vbsx-Validator' is based on bullet 2 above, hence it does not necessarily take into account the 'schemaLocation' specified in the XML document but mostly the externally supplied XSD is only considered.
Validating with XMLSchemaCache
In addition to using the XML Schema instancing (XSI) attributes, MSXML enables you to connect and use an XMLSchemaCache object to validate documents to XSD schemas.
Caching the XSD schema is a good approach to use when you:
-
Want to override the use of other XSD schemas specified in either the schemaLocation or noNamespaceSchemaLocation attributes.
-
Need to use the same XSD schema repeatedly to validate and process a number of documents of the same XML document type.
-
Want to increase performance by loading and caching the XSD schema once, instead of repeatedly loading it with each XML document.