Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.


createCDATASection Method

Creates a CDATA section node that contains the supplied data.

[Script]

Script Syntax

var objXMLDOMCDATASection = oXMLDOMDocument.createCDATASection( data );

Parameters

data A string specifying the value to be supplied to the new IXMLDOMCDATASection object's nodeValue property.

Return Value

An object. Returns the new IXMLDOMCDATASection object.

Example

The following script example creates a new CDATA section node and appends it as the last child node of the DOMDocument object.

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var root; var CDATASection;
xmlDoc.async = false;
xmlDoc.resolveExternals = false;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode <> 0)
{    var myErr = xmlDoc.parseError;   
 alert("You have error " + myErr.reason); }
else {    root = xmlDoc.documentElement;
   CDATASection = xmlDoc.createCDATASection("Hello World!");
   root.appendChild(CDATASection);   
 alert(root.xml); }
Home | Top | Free Ajax Editor | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.