createCDATASection (DOMDocument - JavaScript)

Creates a CDATA section node.

Defined in

DOMDocument

Syntax

createCDATASection(data:string) : DOMCDATASection
Parameters Description
data The content of the CDATA section.
Return value Description
DOMCDATASection The CDATA section.

Usage

This method does not place the node in the DOM. You must, for example, append the node with appendChild in DOMNode.

Examples

This button creates a document with a hierarchy of elements where the last element contains a CDATA section.
var doc = database.createNewDocument();
var dom = doc.getDOM();
var schema0 = dom.createElement("schema0");
var element0 = dom.createElement("element0");
var cdata0 = dom.createCDATASection(requestScope.s);
dom.appendChild(schema0);
schema0.appendChild(element0);
element0.appendChild(cdata0);
doc.save()
The XML for this document might appear as follows if requestScope.s is <foo>:
<schema0>
  <element0><![CDATA[<foo>]]></element0>
</schema0>