By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 943 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

Getting XML Version

P: n/a
Hi,

I want to get my MSXML version from a vb.net program. I do it with the
following piece of code, but I'm not very happy with that:

Dim Version as String = "4.0"
oXML = CreateObject("Msxml2.DOMDocument.4.0") 'Need version 4.
If oXML Is Nothing Then 'Check the existing version
oXML = CreateObject("MSXML2.DOMDocument.3.0")
Version = "3.0"
If oXML Is Nothing Then
oXML = CreateObject("MSXML2.DOMDocument.2.6")
Version = "2.6"
If oXML Is Nothing Then
oXML = CreateObject("MSXML2.DOMDocument")
Version = "2.0"
If oXML Is Nothing Then
Version = "Not detected"
End If
End If
End If
End If

Does anybody know a more elegant way to do this?

Thanks,
Norman

Nov 6 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Norman Chong wrote:
I want to get my MSXML version from a vb.net program.
The .NET framework has its own classes/implementations for XML parsing,
XSLT, XPath, DOM, schema validation, you should not use MSXML from .NET.
I do it with the
following piece of code, but I'm not very happy with that:

Dim Version as String = "4.0"
oXML = CreateObject("Msxml2.DOMDocument.4.0") 'Need version 4.
If oXML Is Nothing Then 'Check the existing version
oXML = CreateObject("MSXML2.DOMDocument.3.0")
Version = "3.0"
If oXML Is Nothing Then
oXML = CreateObject("MSXML2.DOMDocument.2.6")
Version = "2.6"
If oXML Is Nothing Then
oXML = CreateObject("MSXML2.DOMDocument")
Version = "2.0"
If oXML Is Nothing Then
Version = "Not detected"
End If
End If
End If
End If

Does anybody know a more elegant way to do this?
It is not clear what you want to achieve, the latest version of MSXML is
MSXML 6 for instance. And MSXML 3, 4, 5, 6 can all coexist on the same
system. The programming id MSXML2.DOMDocument can be bound to MSXML 3
depending on the installation, with the normal IE 6 installation it is
bound to MSXML 3.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 6 '06 #2

P: n/a

Martin Honnen schrieb:
>
It is not clear what you want to achieve, the latest version of MSXML is
MSXML 6 for instance. And MSXML 3, 4, 5, 6 can all coexist on the same
system. The programming id MSXML2.DOMDocument can be bound to MSXML 3
depending on the installation, with the normal IE 6 installation it is
bound to MSXML 3.
Sorry if it was unclear what I want to do - I try it again ;-)
The program should check, if there is MSXML 4.0 installed (it has to do
this for another application, which needs 4.0 - That's why I started
with 4.0 in my code), if not it should get the next lower version which
is installed and show it within a MessageBox.

Nov 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.