I'm using the attached code to read an XML file. The problem is, I'm encountering a lot of special characters such as "é" and even "&" which causes it to fail with one of the following errors:
Error #-1072896760 (Line: 41) - An invalid character was found in text content.
Error #-1072896749 (Line: 41) - Whitespace is not allowed at this location.
The XML files are coming from multiple export sources, so I'd really like to handle these on the import. Any suggestions?
set xmlDoc = CreateObject("Msxml2.DOMDocument")
if xmlDoc.parseError.errorCode = 0 then
(read elements and do stuff)
set logFS = CreateObject("Scripting.FileSystemObject")
set objLogFile = logFS.OpenTextFile(logfile, 8, True)
objLogFile.writeline(vbtab & "Error #" & xmlDoc.parseError.errorCode & " (Line: " & xmlDoc.parseError.line & ", " & xmlDoc.parseError.linepos & ") - " & xmlDoc.parseError.reason)
set logFS = nothing
set objLogFile = nothing