Print this page

Pass HTML syntax through the Marketing Cloud XML API

Knowledge Article Number 000213067
Description
If HTML syntax is passed into the XML API without being properly escaped then it can result in an error being returned.  Depending on the HTML that is passed, it results in an error code 39 or 71.
 
Resolution
In order to pass in HTML within the API XML, you need to convert it to the correct format.  This conversion involves converting to XML Safe followed by URL encoding. 



Example

 
Initial string:
Line 1<br />Line2<br />
After converting to XML safe:
Line 1&lt;br /&gt;Line2&lt;br /&gt;
After URL encoding:
Line%201%26lt%3Bbr%20%2F%26gt%3BLine2%26lt%3Bbr%20%2F%26gt%3B 



XML Safe encoding details

Changing a string to XML Safe involves replacing the five XML reserved characters with their correct escape sequence.  Those five substitutions are:
 
CharacterSubstitution
<&lt;  
&&amp; 
&gt; 
'&apos;
"&quot; 




promote demote