Skip to main content
Inspiring
June 26, 2018
Answered

[JS] How to add CDATA section to xml?

  • June 26, 2018
  • 1 reply
  • 706 views

var tagRoot = new XML("<test>"); 

tagRoot.FirstElem =  "First";  

tagRoot.SecondElem = "Second";  

alert(tagRoot); 

I want to add CDATA section to element like below.

<test>

     <FirstElem><![CDATA[First]]></FirstElem>

     <SecondElem>Second</SecondElem>

</test>

Please help me.

Thanks in advance.

This topic has been closed for replies.
Correct answer Loic.Aigon

Can't…this is a known limitation…

1 reply

Loic.Aigon
Loic.AigonCorrect answer
Legend
June 26, 2018

Can't…this is a known limitation…