XML DOM - CDATASection Object
Try it - Example
The following example uses the XML file books.xml.
External JavaScript to load the XML file.
createCDATASection() - Creates a CDATA section node
CDATASection Object
The CDATASection object represents a CDATA section in a document.
A CDATA section contains text that will not be parsed by the parser. Tags inside 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 the delimiters.
The only delimiter recognized inside 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
| Method | 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. |