Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XMLDocument and encoding problem inside XML

From: robson@-----------.---------.---
To: NULL
Date: 8/2/2009 5:51:00 AM
thanks a lot Martin,
so CDATA makes XML to treat this part as a text and that's why it is 
escaped, I think i got it now.

"Martin Honnen" wrote:

> robson wrote:
> > hi Martin,
> > Web service is using System.Xml.XmlDocument to prepare the XML, and the 
> > problem seems to be the section which is escaped with CDATA. It is escaped 
> > because I have one xml embedded in another, kind of - second xmlns inside. 
> > The problem arrives on c++ client using MXSML3 where when I debug I see 
> > something like that <goodxmltag><escaped xml tags with 
> > attributes></goodxmltag>  By escaped xml tags I mean that ampersand, greater 
> > then, semicolon instead of xml "<>" tags. I don't getting error when I load 
> > that xml, but when I want parse arguments for that escaped tag node list is 
> > obviously zero and got exception. This xml string when using visual studio 
> > 2008 XML visualizer is displaying properly.
> 
> I would suggest to read out the escaped XML with 'text' property and 
> then feed that string to the loadXML method of a second MSXML DOM 
> document e.g. (using MSXML 3 with JScript, please translate to C++ 
> yourself):
> 
> var xml1 = 
> '<root><foo><![CDATA[<bar><baz>whatever</baz></bar>]]></foo></root>';
> var doc1 = new ActiveXObject('Msxml2.DOMDocument.3.0');
> doc1.loadXML(xml1);
> doc1.setProperty('SelectionLanguage', 'XPath');
> 
> var foo = doc1.selectSingleNode('root/foo');
> 
> var xml2 = foo.text;
> 
> var doc2 = new ActiveXObject('Msxml2.DOMDocument.3.0');
> doc2.loadXML(xml2);
> doc2.setProperty('SelectionLanguage', 'XPath');
> 
> var baz = doc2.selectSingleNode('bar/baz');
> 
> 
> I hope that makes it clear, read out the 'text' property of the element 
> that contains the escaped XML, then feed that text to the loadXML method 
> of a second MSXML DOM document.
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://msmvps.com/blogs/martin_honnen/
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent