Link to home
Start Free TrialLog in
Avatar of Lime_Sweden
Lime_Sweden

asked on

encoding is removed on MSXML2.DOMDocument.loadXML

Hi!
I have an XML string that starts with the following "<?xml version=""1.0"" encoding=""iso-8859-1""?>...

however when loading the string with MSXML2.DOMDocument.loadXML the encoding attribute is removed and all that is left on the first row is "<?xml version="1.0"?>...

I need to set the encoding in order to succeed to send my request to a webservice but I have tried everything without succeeding...

What I have tried for exemple is to: (xmlCustomersRequest beeing my MSXML2.DOMDocument object)
-Call xmlCustomersRequest.childNodes(xmlCustomersRequest.createProcessingInstruction("xml", "version='1.0' encoding='iso-8859-1'")) - this worked BUT it removed the encoding again and only added another <?xml version="1.0"?> at the end of the xml...

-to add the first row upon sending the request: (I remove it first from the xmlstring of course)
objHTTP.Send ("<xml version=""1.0"" encoding=""ISO-8859-1"">" + xmlCustomersRequest.XML) - this wasn't allowed

to replace the "<?xml version=""1.0""?>" upon sending the request:
objHTTP.Send(VBA.Replace(xmlCustomersRequest.XML, "<?xml version=""1.0""?>", "<?xml version=""1.0"" encoding=""ISO-8859-1""?>") - but this wasn't allowed either

If someone have the solution to this problem please please please enlight me!!
ASKER CERTIFIED SOLUTION
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial