Solved

encoding is removed on MSXML2.DOMDocument.loadXML

Posted on 2007-11-21
3
1,922 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
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Customer support / help desk app 4 90
How to handle PHP $_POST requests 4 51
Search on a site 5 70
Image Orientation On Website 6 43
      Install BugTracker on Windows 2008 server Step 1:  Install windows 2008 server 32 bit OS and configure IIS. Step 2:  Install SQL server ( SQL server 2005 or SQL server 2005 Express edition. The installer for 2008  version isn’t very f…
New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
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…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now