Escaping apostrophy and quote in mapping output

Situation:

We are passing this element into a data mapper from a file source:
<Complaint>DATA &lt; LESS &gt; GREATER &amp; AND &apos; APOS &quot; QUOTE</Complaint>
The element is mapped to an output element with no changes. The resulting XML document contains this:
<Complaint>DATA &lt; LESS &gt; GREATER &amp; AND ' APOS " QUOTE</Complaint>


The partner with whom we are communicating is asking that we escape the apostrophy and quote in the output XML document with their corresponding pre-defined entities: &apos; and &quote;


Is there a simple way to do this short of passing the output stream through a custom plug-in to search for these characters?

Solution:

"&apos;" and "&quot;" are the identifier that data mapper also uses in data mapping to manage the data that has apostrophe and quotes in XML.

If you want to retain such identifiers in data mapping, please try to put such data in CDATA section on both source and target.

For example in your case :-
your source data should appear as :-- <Complaint><![CDATA[DATA &lt; LESS &gt; GREATER &amp; AND &apos; APOS &quot; QUOTE]]></Complaint>

In target node of the XML enable CDATA section in data mapping, which can be done by going to Action Menu and select option “Cdata section elements”, place the target node name in the value and save.

Have more questions? Submit a request

0 Comments

Article is closed for comments.