Page 1 of 1

Create/modify CDATA section in XML files...?

Posted: Fri May 11, 2018 7:31 pm
by BuckXUK
Hello everyone

I'm checking in to see if anyone has come up with a way to modify or replace a CDATA section using the scripting API in Switch?

I'm able to retrieve the CDATA contents and modify the string data using string.replace, but I don't see any way to create and/or replace the CDATA elements in XML.

If there was only one iteration of a CDATA section, I'd happily SED it into position but there will be literally thousands per file.

Does anybody have any ideas?

Thanks in advance.

Re: Create/modify CDATA section in XML files...?

Posted: Mon May 14, 2018 7:16 am
by r.zegwaard
Currently the scripting API doesn't support CDATA :cry: . The workaround would be to create/edit the xml and add the CDATA tags manually as "<![CDATA[content]]>" . After that, load the file as normal text-file, and do a search/replace.

A feature-request (ENFFR-1968) has been made to support CDATA.

Re: Create/modify CDATA section in XML files...?

Posted: Mon May 14, 2018 6:28 pm
by BuckXUK
Thanks for the reply and suggestions.

I'm exploring other options with the customer how to best handle this...hopefully we'll get that feature sometime in the not-to-distant future.

Thanks again.