tags:

views:

71

answers:

1

How do I clear the .Schemas of a IXMLDOMDocument2 after I have added a schema to a IXMLDOMSchemaCollection2 then assigned to the .Schemas of the IXMLDOMDocument2?

So I am trying to valdiate a xml against multiple XSD one by one, but it seems the XSD gets "accumulated" at the xml document object.

Must I create a new xml document object for every validate?

A: 

There is no method to remove a schema from a schema collection so, if you want to clobber the schemata that you've previously added, you must set the IXMLDOMDocument2::schemas property to a new schema collection. If you simply want to clear the schemata without adding a new one, you can pass a VARIANT set to VT_EMPTY.

Phil Booth