Latest web development tutorials

XML DOM - CDATASection objects

Examples

Try - Example

The following example uses XML files the Books.xml .
External JavaScript is used to load the XML file.

createCDATASection () - Creates a CDATA section node


CDATASection objects

CDATASection object represents a CDATA section in a document.

CDATA section contains text will not be parsed by a parser. A CDATA section tag will not be treated as markup and entities will not be expanded. The main purpose is to contain information such as XML fragments of material, without needing to escape all the delimiters.

In a CDATA section uniquely identified separator is the "]]>", which may mark the end of a CDATA section. CDATA sections can not be nested.

CDATASection object properties

属性 描述
data 设置或返回此节点的文本。
length 返回 CDATA 区段的长度。

CDATASection object methods

方法 描述
appendData() 向节点追加数据。
deleteData() 从节点删除数据。
insertData() 向节点中插入数据。
replaceData() 替换节点中的数据。
splitText() 把 CDATA 节点分拆为两个节点。
substringData() 从节点提取数据。