Adds all the schemas from another collection into this collection, replacing any schemas that collide on the same namespace URI.
objXMLDOMSchemaCache.addCollection(objXMLDOMSchemaCache)
There is no guarantee that the two collections will return exactly the same schema objects—the collection is free to clone them if necessary.
Adding a collection to itself has no effect.
Dim xmldoc As New MSXML2.FreeThreadedDOMDocument Dim xsldoc As New MSXML2.FreeThreadedDOMDocument Dim SchemaCache As New MSXML2.XMLSchemaCache Dim SchemaCache2 As New MSXML2.XMLSchemaCache xmldoc.loadXML "<root><bar>bar</bar></root>" xsldoc.async = False xsldoc.validateOnParse = False SchemaCache.Add "x-schema:books", "d:\inetpub\wwwroot\bookschema.xml" SchemaCache2.addCollection SchemaCache SchemaCache2.Add "x-schema:books", "d:\inetpub\wwwroot\newbookschema.xml" Set xsldoc.schemas = SchemaCache2 ' The document will load only if a valid schema is attached to the xml ' file. xsldoc.Load "d:\inetpub\wwwroot\samplexmldtd.xml" MsgBox xsldoc.xml
d:\inetpub\wwwroot\samplexmldtd.xml
<?xml version='1.0'?>
<COLLECTION xmlns="x-schema:books"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<DATE dt:dt="datetime">1998-10-13T15:56:00</DATE>
<BOOK>
<TITLE>Cosmos</TITLE>
<AUTHOR>Carl Sagan</AUTHOR>
<PUBLISHER>Ballantine Books</PUBLISHER>
</BOOK>
</COLLECTION>
Output (in a message box)
<?xml version='1.0'?>
<COLLECTION xmlns="x-schema:books"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<DATE dt:dt="datetime">1998-10-13T15:56:00</DATE>
<BOOK>
<TITLE>Cosmos</TITLE>
<AUTHOR>Carl Sagan</AUTHOR>
<PUBLISHER>Ballantine Books</PUBLISHER>
</BOOK>
</COLLECTION>
Applies To: XMLSchemaCache