BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


JavaScript
XML Cache using IE 5.0 Behaviour
XML cache on client for the desktop application website
Javascript XML element listing
Sorting Data Islands by clicking on the column header (using behaviors).
Simple JS Menu Tree using XSLT
xml report writer
Filtering Data Islands
Small XML/XSL application with JavaScript
Table Column sorting using XML, XSL and JavaScript
Display of Hierarchical Data Islands
x++ beta 0.2 release (includes ISAPI filter/interpreter)
HTTP File Commander
XML Ticker
Fading Ticker
How to understand the flow of control in XLST
Begginers, search the Bible
JavaScript Ticker (using Tabular Data Control)
-postfix.aspx>Infix <> Postfix
Nested Tables And Data Island
XML Data Traversal


 
 

 LAMP >>


By Michael Carter
First Posted 06/05/2001
Times viewed 446

Updated: Detect XML Parser version using Javascript


This post contains attachments
v20010605222658.zip 

Summary Here is some script that can be used to determine what version of the XML Parser is installed on your computer and whether it is in Replace mode or Side-by-side.

To use this function, create an XmlVersionSniffer object, and view the properties versionreplace, and versions. Like this:

<script language=javascript>
   
    var xmlsniffer = new XmlVersionSniffer();
    document.writeln(Highest Version: + xmlsniffer.version);
    document.writeln(Replace Mode: + xmlsniffer.replace);
    document.writeln(All Versions:);
    for (var version in xmlsniffer.versions) {
        document.writeln(xmlsniffer.versions[\ + version + \] ==
            + xmlsniffer.versions[version]);
    }    
    document.writeln(<hr>Log:<br> + xmlsniffer.log);
   
</script>

Read the comments in the code to see how it works.

To verify the code, do the following at the command line:

    xmlinst -u
    regsvr32 -u msxml4.dll
(xmlinst does not work on version 4)

At this point, there is no parser defined, so you should get

    Highest Version: unknown
    Replace Mode: false

Now type the following to install the original parser in IE5.
    
    regsvr32 msxml.dll

You should now get:
    
    Highest Version: 2.5
    Replace Mode: false
    All Versions:
    xmlsniffer.versions[2.5] == true

Now type the following:

    regsvr32 msxml2.dll

You should now get:

    Highest Version: 2.6
    Replace Mode: false
    All Versions:
    xmlsniffer.versions[2.5] == true
    xmlsniffer.versions[2.6] == true

Now type the following:

    regsvr32 msxml3.dll   

You should now get:

    Highest Version: 3.0
    Replace Mode: false
    All Versions:
    xmlsniffer.versions[2.5] ==  true
    xmlsniffer.versions[2.6] == true
    xmlsniffer.versions[3.0] == true
   
xmlsniffer.versions[3.0sp1] == true


Note: 3.0sp1 is true only if Service Pack 1 has been installed.  

Now type the following:

    regsvr32 msxml4.dll   

You should now get:

    Highest Version: 4.0
    Replace Mode: false
    All Versions:
    xmlsniffer.versions[2.5] == true
    xmlsniffer.versions[2.6] == true
    xmlsniffer.versions[3.0] == true
    xmlsniffer.versions[3.0sp1] == true
    xmlsniffer.versions[4.0] == true

So up to this point, we have been in side-by-side mode. So lets run xmlinst. First we'll reset everything, and get to version 3

    xmlinst -u
    regsvr32 -u msxml4.dll
    regsvr32 msxml.dll
    regsvr32 msxml2.dll
    regsvr32 msxml3.dll
    xmlinst

Now we should get:

    Highest Version: 3.0
    Replace Mode: true
    ...

If you had version 4 installed, don't forget to do this:
    
    regsvr32 msxml4.dll

Ok, well that's all.

Any feedback would be appreciated.

--
Michael J. Carter
Sr. Software Engineer

__ s t a r w i r e ________________________________
Focusing the power of the Internet for networked communities.
t: 510.723.1020 x270   f: 510.723.1021
mcarter@starwire.com   http://www.starwire.com

Additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

 LAMP >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML