Hello, I'm receiving the following error when parsing XML as answer from a webservice.
- An invalid character was found in text content.
The webservice sends answers with some characters as Ψ for example or HTML structured tests malformed with " or < and > characters.
The code used is:
Set var_xmlPostObject = CreateObject("MSXML2.ServerXMLHTTP.3.0")
Set var_xmlRequestDoc = CreateObject("MSXML2.DOMDocument")
Set var_xmlResponseDoc = CreateObject("MSXML2.DomDocument.3.0")
'Send xml
Call var_xmlRequestDoc.loadXML(str_xml)
Dim var_pi As Variant
Set var_pi = var_xmlRequestDoc.CreateProcessingInstruction("xml", "version='1.0' encoding='ISO-8859-1'")
Call var_xmlRequestDoc.InsertBefore(var_pi, var_xmlRequestDoc.ChildNodes(0)) 'open the POST (or GET) connection to the web server
Call var_xmlPostObject.open("POST", str_soapPost, False)
Call var_xmlPostObject.setRequestHeader("Content-Type", str_soapType)
Call var_xmlPostObject.send(var_xmlRequestDoc.xml)
'Set response properties
var_xmlResponseDoc.async = False
var_xmlResponseDoc.validateOnParse = False
var_xmlResponseDoc.resolveExternals = False
Set var_xmlResponseDoc = var_xmlPostObject.responseXML
Print "var_xmlResponseDoc.xml: " & var_xmlResponseDoc.xml
If var_xmlResponseDoc.parseError.errorCode <> 0 Then
'Alert
Else
'Do something
End if
The question is if there's a way to detect the characters which brings the message before parse it? Some example would be very nice.
Thanks in advance.