Forum Discussion
Raul,
This error occurs because the XML parser was unable to process the DOCTYPE instruction in the xml file storing results.
Try using this code:
Function GetSum(sType)
Dim tempFolder, xDoc, wrnC, errC
' Prepare a temporary folder
tempFolder = aqEnvironment.GetEnvironmentVariable("temp") & "\" & IntToStr(10000) & "\"
aqFileSystem.CreateFolder(tempFolder)
' Save results to an .xml file
Call Log.SaveResultsAs(tempFolder, lsXML, True)
' Create an XMLDocument
Set xDoc = Sys.OleObject("MSXML2.DOMDocument.4.0")
' Set xDoc = Sys.OleObject("MSXML2.DOMDocument.6.0")
' xDoc.validateOnParse = false
' Load the file
Call xDoc.load(tempFolder & "Description.tcLog")
' Check the load result
If xDoc.parseError.errorCode <> 0 Then
Log.Message "File load result: "& xDoc.parseError.errorCode, _
"Error code: " & xDoc.parseError.errorCode & Chr(13) & Chr(10) & _
"Description: " & xDoc.parseError.reason & Chr(13) & Chr(10) & _
"Line No: " & xDoc.parseError.line & Chr(13) & Chr(10) & _
"Column: " & xDoc.parseError.linepos & Chr(13) & Chr(10) & _
"Source text: " & xDoc.parseError.srcText
Exit Function
End If
' Count warnings
wrnC = xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='warning count']/@value").text
' Count errors
errC = xDoc.selectSingleNode("Nodes/Node[@name='root']/Prp[@name='error count']/@value").text
' Remove the temporary folder
Call aqFileSystem.DeleteFolder(tempFolder, True)
' Return the result
Select Case sType
Case "w" : GetSum = CStr(wrnC)
Case "e" : GetSum = CStr(errC)
Case Else
GetSum = "Wrong parameter"
End Select
End Function