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

Checking server for Msxml2.DOMDocument.6.0

Explorer ,
Jul 05, 2007 Jul 05, 2007
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
849
Translate
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
Translate
Explorer ,
Jul 05, 2007 Jul 05, 2007
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.

Translate
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
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
Translate
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