Getting XML Version

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Norman Chong

    Getting XML Version

    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("M sxml2.DOMDocume nt.4.0") 'Need version 4.
    If oXML Is Nothing Then 'Check the existing version
    oXML = CreateObject("M SXML2.DOMDocume nt.3.0")
    Version = "3.0"
    If oXML Is Nothing Then
    oXML = CreateObject("M SXML2.DOMDocume nt.2.6")
    Version = "2.6"
    If oXML Is Nothing Then
    oXML = CreateObject("M SXML2.DOMDocume nt")
    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

  • Martin Honnen

    #2
    Re: Getting XML Version

    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("M sxml2.DOMDocume nt.4.0") 'Need version 4.
    If oXML Is Nothing Then 'Check the existing version
    oXML = CreateObject("M SXML2.DOMDocume nt.3.0")
    Version = "3.0"
    If oXML Is Nothing Then
    oXML = CreateObject("M SXML2.DOMDocume nt.2.6")
    Version = "2.6"
    If oXML Is Nothing Then
    oXML = CreateObject("M SXML2.DOMDocume nt")
    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.DOMDocum ent 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

    Comment

    • Norman Chong

      #3
      Re: Getting XML Version


      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.DOMDocum ent 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.

      Comment

      Working...