SAX Validation against multiple XSDs in MSXML
I'm using MSXML 6.0 for SAX parsing in a C++ application.
How do I validate my XML against an XSD which is in-memory (not a physical file), and which in turn references 3 other XSDs through the <xsd:include schemaLocation="abc.xsd"/> construct?
All the four XSDs are housed inside a DLL and have to be used without converting them to actual files.
Currently, I am following the steps below to accomplish the desired validation:
1. Writing the contents of the primary xsd to a IStream
2. Attaching this IStream to a IXMLDOMDocument, and then
3. Parse this xsd to retreive the name of the other three xsds it internally reference
4. Extract the bodies of each of these xsds and insert them one-by-one just after the header of the main xsd.
5. The new (& large) programmatically created xsd is then added to the IXMLDOMSchemaCollection2.
This is resulting in a huge performance-hit, and the performance benefits for which I am shifting from xerces to MSXML remains unjustified.
Request you to please suggest a better method of performing validation in this scenario.