Solved

encoding is removed on MSXML2.DOMDocument.loadXML

Posted on 2007-11-21
3
1,990 Views
Last Modified: 2010-07-27
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!!
0
Comment
Question by:Lime_Sweden
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 20336182
If I understand correctly, the encoding is not part of the XML document - it is guidance to converting the sequence of bytes in the input into a string.  Once you HAVE it as a string, it is no longer encoded, so it makes sense for the encoding to "disappear", since when you output the document you could use a completely different encoding.

0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question