Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XMLDocument and encoding problem inside XML >Thread Next - Re: XMLDocument and encoding problem inside XML Re: XMLDocument and encoding problem inside XMLTo: NULL Date: 8/2/2009 2:21:00 PM 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/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
