?
Solved

encoding is removed on MSXML2.DOMDocument.loadXML

Posted on 2007-11-21
3
Medium Priority
?
2,027 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 2000 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

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
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…

719 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