Encoding switch error

webmasterbeta

New Member
I am using DOM in VB to access an XML file. The heading in the XML file containsthis:<?xml version="1.0" encoding="UTF-8" ?>When I try to open the file, I get the error "Switch from current encodingto specified encoding not supported". If I remove the 'encoding="UTF-8"'parameter, it works fine. Unfortunately, I am not at liberty to do that ina real production environment.I cannot find any answers in the MSDN documentation. I am a seasoned VB programmerwho is relatively new to XML.Here is the code I am using:Dim objDoc as DOMDocumentDim intFile as IntegerDim strFileText as String' Move file text into a stringOpen "D:\Test.xml" For Input As intFilestrFileText = input(LOF(intFile), intFile)Close intFile' Initialize DOM Document objectSet objDoc = New DOMDocument' Load text string into DOM objectIf Not objDoc.loadXML(strFileText) ThenstrErrMsg = objDoc.parseError.reason' <Error formating, etc...>End IfAny help is appreciated...
 
Back
Top