Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XML DOM - CDATASection object


May 27, 2021 XML DOM


Table of contents


XML DOM - CDATASection object

The XML DOM CDATASection object describes the CDATA section in the XML data.


XML DOM - CDATASection object

Try it - instance

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

CreateCDATASection() - Create a CDATA segment node


CDATASection object

The CDATASection object represents the CDATA segment in the document.

The CDATA segment contains text that is not parsed by the parser. L abels in a CDATA segment are not considered tags, and entities are not expanded. The primary purpose is to contain materials such as XML fragments without having to escape all separators.

The only identified separator in a CDATA segment is the " CDATA segments cannot be nested.

CDATASection object properties

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

CDATASection object method

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

That's all about the XML DOM - CDATASection object.