How can i ask what version of MSXML an IXMLDOMDocument2 is? Given an IXMLDOMDocument2 i need to create another document of the same version.
If you give an IXMLDOMDocument from different versions of MSXML, you will get an exception from msxml:
It is an error to mix objects from different versions of MSXML.
Microsoft internally can ask an interface what version of MSXML it came from, i need access to the same thing.
Consider the following hypothetical function written in pseudo-code:
String XMLTransform(IXMLDOMNode xml, String xsl)
{
//Create a document to hold the xml
IXMLDOMDocument2 xslDocument = new CoDOMDocument();
//load the xsl string into the xsl dom document
xslDocument.loadXML(xsl);
//transform the xml
return xml.transformNode(xslDocument);
}
Problem is that if IXMLDOMNode comes from, say MSXML6. The created DOMDocument
is from version 3 (because of Microsoft's version dependance in MSXML). This will cause the
xml.transformNode()
to throw a COM exception:
It is an error to mix objects from different versions of MSXML.
Since Microsoft is able to ask an interface what version of MSXML it came from, i should be able to do the same thing, but how?
Alternativly, given an IXMLDOMNode
, how can i construct an XMLDOMDocument
object of the same version...