CDATA in Mergado#

What is CDATA and why does it matter?#

CDATA (short for Character Data) is a way to protect a portion of text in XML from being interpreted as code. In e-commerce feeds, it is mainly useful where elements contain HTML or special characters — typically in <DESCRIPTION> or <LONGDESC>. Without CDATA, HTML tags (e.g. <p>, <strong>) could be read as XML elements, which leads to an invalid feed or lost content.

What is CDATA?#

CDATA marks a section of text that is not parsed as XML and remains exactly as written.

Example:

<DESCRIPTION><![CDATA[<p>Stylish shirt <strong>made of cotton</strong></p>]]></DESCRIPTION>

Without CDATA, the HTML tags <p> and <strong> could be interpreted as XML elements and cause an error in the feed.

How to add CDATA in Mergado?#

  1. Go to the Elements tab.
  2. For the desired element (e.g. DESCRIPTION), click the CDATA icon.
  3. Regenerate the output feed: Settings → Regeneration, so the change takes effect.
  4. Need to remove CDATA? Simply toggle the wrapping off again for the same element.

B) Manual method: using the Rewrite rule#

  1. Create a Rewrite rule for the given element.

  2. In the New value field, enter the CDATA wrapper, e.g.:

    <![CDATA[%PRODUCTNAME%]]>
  3. After regeneration, you will see something like this in the output feed:

    <PRODUCTNAME><![CDATA[Tričko pánské černé s krátkým rukávem]]></PRODUCTNAME>

Practical tips#

  • Use CDATA for elements with HTML formatting (e.g. DESCRIPTION) or special characters.
  • After every change, remember to regenerate the feed (Settings → Regeneration).
  • When CDATA is missing, some HTML tags may break validation or not display correctly.

FAQ#

What exactly is CDATA?#

It is a section in XML whose content is not interpreted as code but is taken literally as text.

When should I use CDATA?#

When an element contains HTML or special characters — most commonly with DESCRIPTION or LONGDESC.

What is the quickest way to wrap an element in CDATA in Mergado?#

In the Elements tab, click the CDATA icon for the element in question, then regenerate the feed.

How do I add CDATA manually?#

Create a Rewrite rule and enter the CDATA wrapper as the new value, e.g. <![CDATA[%PRODUCTNAME%]]>.

Do I need to do anything after making the change for it to take effect?#

Yes, you need to regenerate the output feed: Settings → Regeneration.

What happens if I don’t use CDATA?#

HTML tags may be treated as XML tags, leading to validation errors or loss/corruption of content.

Can I turn off CDATA wrapping again?#

Yes, in the Elements tab, simply disable the wrapping for the element using the same icon.

🇨🇿 🇬🇧 🇩🇪 🇭🇺