XML DOM - CDATASectionObject


实例

Try it - Example

The following example uses an XML filebooks.xml。
External JavaScriptUsed to load XML files.

createCDATASection() - Create a CDATA section node


CDATASection Object

The CDATASection object represents the CDATA section in a document.

CDATA sections contain text that will not be parsed by the parser. Tags within a CDATA section are not treated as markup, and entities are not expanded. The main purpose is to include material such as XML fragments without having to escape all delimiters.

The only delimiter recognized within a CDATA section is "]]>", which marks the end of the CDATA section. CDATA sections cannot be nested.

CDATASection Object Properties

Property Description
data Sets or returns the text of this node.
length Returns the length of the CDATA section.

CDATASection Object Methods

Methods Description
appendData() Appends data to the node.
deleteData() Deletes data from the node.
insertData() Inserts data into the node.
replaceData() Replaces data in the node.
splitText() Splits the CDATA node into two nodes.
substringData() Extracts data from the node.

other extensions