mgaert
9 years agoNew Contributor
how to find the MSXML version?
Hi, I am developing a script extension for testcomplete. I want to know if there is a way to find aout wich MSXML version is installed on the maschine. Because the command "Sys.OleObject('Msx...
- 9 years ago
Use Msxml2.DOMDocument.6.0 - it's included in all Windows versions since Windows XP SP3. Msxml2.DOMDocument.4.0 is obsolete, don't use it. If you want a fallback, use Msxml2.DOMDocument.3.0 as an alternative.
So, this should be enough:
// JScript var xmlDOM = Sys.OleObject("Msxml2.DOMDocument.6.0");
But if you want a fallback use something like:
// JScript
function Test()
{
var xmlDOM = GetXMLDOMDocument();
if (xmlDOM != null) {
// Do something
}
else
{
// Neither MSXML 6 nor MSXML 3 was found - something's wrong with the computer
}
}
function GetXMLDOMDocument() { var progIDs = ['Msxml2.DOMDocument.6.0', 'Msxml2.DOMDocument.3.0']; for (var i = 0; i < progIDs.length; i++) { try { var xmlDOM = Sys.OleObject(progIDs[i]); return xmlDOM; } catch (ex) { } } return null; }References:
https://en.wikipedia.org/wiki/MSXML#Versions
http://blogs.msdn.com/b/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx