Force n8n to to wrap 'all' XML tag values in CDATA

I have a request to generate XML file with ALL values wrapped in a CDATA block.

The current XML generator does have an option to use CDATA, but per documentation, it only inserts CDATA wrapper “when necessary”. Apparently using some logic searching for certain characters, or XML/HTML markup tags within the value (that would/should be escaped).

Is there a way to do this, or do I have to create a feature request?

Note: I know it’s not mandatory for each tag value per XML specs. Not my request to have it everywhere :slight_smile:

Hey @Peter_Nemsak,

Welcome to the community :raised_hands:

It would need a feature request but to be honest I am not sure what you are actually trying to do, Could you share some example data that would help show what you are trying to do?

Hi, thx for the reply. It’s exactly what is in the title, ie.:

<items>
   <item>
      <name><![CDATA[John]]></name>
      <surname><![CDATA[Carpenter]]></surname>
      <address><![CDATA[North 12, Alabama, NY]]></address>
      <profile><![CDATA[<p>A very good person, has a <strong>dog</strong> and only drinks beer.</p>]]></profile>
   </item>
</items>

As I noted, I do know that the only value that really requires CDATA wrapper is the profile tag content in this case. But the recipient of the XML requested explicitly that all values need to be wrapped :person_shrugging:

I guess it could be manually processed/replaced somehow, but the functionality is already implemented, it just tries to be (understandably) smart and wrap only things that do require wrapping.

Is it clearer now?

Hey @Peter_Nemsak,

That is a lot clearer thanks, So the quick version is it looks like the package we use uses the cdata option when it needs to escape any characters.

I have swapped this over to a feature request so we can track the votes for future development.

Thanks @Jon :slight_smile: let’s see if and when it lands :wink: