METHOD:  Document::createCDATASection


The createCDATASection method creates a CDATASection object whose value is the text supplied as the argument. Creating an instance of this object does not automatically include it in the XML Document tree, and so its parentNode property is set to null.

The following example creates a CDATASection consisting of a copyright notice, and appends it to the children of the document's root element. It then displays the new node's type, name and value.

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False

Dim root, objNewCDATA, currNode
Set root = objXMLDoc.documentElement
Set objNewCDATA = objXMLDoc.createCDATASection("Copyright Notice")

Set currNode = root.lastChild
document.write("<br>" & currNode.nodeName)
document.write("<br>" & currNode.nodeValue)

Copyright Notice

The value '4' returned for the node's type indicates that it is a CDATASection object (see the list of node types).

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information