Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

Escaping characters in XML for a SOAP request

$
0
0
Hi everyone,

I have a little issue generating an XML. At first look, it seems that the XML is OK, but I find problem when I try to make a request with it.

The XML should have a field like this:
<collectionDateTime><![CDATA[2017-12-14T08:10:00]]></collectionDateTime>

I create the field in the XML like this:
lvl2XMlNode := XMLDocOut.createNode(1,'collectionDateTime','');
ConsigmentXMlNode.appendChild(lvl2XMlNode);
DomTextNode := XMLDocOut.createTextNode('<![CDATA[2017-12-14T11:35:00]]>');
lvl2XMlNode.appendChild(DomTextNode);

At the first look, I open the XML file with the briowser, and seems to be fine:

lbnysb8xs7fm.png

But the issue is that, this XML file is sent in a request in text format, and if I open it with the editor, I can see this:
collectionDateTime>&lt;![CDATA[2017-12-14T11:35:00]]&gt;</collectionDateTime>

So that provokes a marshalling error in the web service. How can I add the character correctly? I've tried to scape them in different ways, but i can't find the correct approach.

Any hint will be really appreciated.
Thanks!

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>