Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Checking server for Msxml2.DOMDocument.6.0

Explorer ,
Jul 05, 2007 Jul 05, 2007

Copy link to clipboard

Copied

I am working on an ASP function that checks the server for Msxml2DOMDocument 6.0. The function works great on my development server, but on a real world server it returns Type Mismatch. This happens only when I check for 6.0., if I check for 4.0 it runs good. How do I handle a Type Mismatch error in classic asp?

Thanks David


Function checkXMLversion6()
Dim textxml

Err.Clear
Set testxml = Server.CreateObject("Msxml2.DOMDocument.6.0")
On Error Resume Next

if Err.Number <> 0 then
Response.Clear()
checkXMLversion6 = True
else
checkXMLversion6 = False
end if
End Function
TOPICS
Server side applications

Views

804
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jul 05, 2007 Jul 05, 2007
Working version

Function checkXMLversion6()
Dim textxml

On Error Resume Next
Set testxml = Server.CreateObject("Msxml2.DOMDocument.6.0")
If Err.Number<>0 Then
checkXMLversion6 = False
Err.Clear 'must have'
else
checkXMLversion6 = True
end if
End Function

Votes

Translate
Explorer ,
Jul 05, 2007 Jul 05, 2007

Copy link to clipboard

Copied

Update to code
Function checkXMLversion6()
Dim textxml

On Error Resume Next
Set testxml = Server.CreateObject("Msxml2.DOMDocument.6.0")

If Err.Number<>0 Then
checkXMLversion6 = False
else
checkXMLversion6 = False
end if
End Function

This returns an error number of -2147221005. The If Err.Number<>0 is not working.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 05, 2007 Jul 05, 2007

Copy link to clipboard

Copied

LATEST
Working version

Function checkXMLversion6()
Dim textxml

On Error Resume Next
Set testxml = Server.CreateObject("Msxml2.DOMDocument.6.0")
If Err.Number<>0 Then
checkXMLversion6 = False
Err.Clear 'must have'
else
checkXMLversion6 = True
end if
End Function

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines