[thelist] Detecting versions of XML parser in IE?

Liorean Liorean at user.bip.net
Tue Mar 12 15:25:01 CST 2002


At 15:17 2002-03-12 -0600, Scott Dexter wrote:
>I've been asked to pass this question along:
>
>Is there a way (through javascript, presumably) to detect the version of
>XML parser in IE? We're doing some stuff that apparently IE 5.0 (and its
>ome parser) doesn't like.
>
>Any ideas?

Take a look at <http://webfx.eae.net/dhtml/xmlextras/xmlextras.html>, which
contains this beutiful code:

function getControlPrefix() {
    if (getControlPrefix.prefix)
       return getControlPrefix.prefix;

    var prefixes = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];
    var o, o2;
    for (var i = 0; i < prefixes.length; i++) {
       try {
          // try to create the objects
          o = new ActiveXObject(prefixes[i] + ".XmlHttp");
          o2 = new ActiveXObject(prefixes[i] + ".XmlDom");
          return getControlPrefix.prefix = prefixes[i];
       }
       catch (ex) {};
    }

    throw new Error("Could not find an installed XML parser");
}



Does that help any?
// Liorean




More information about the thelist mailing list