XML DOM - CDATASection
Object
Try It - Example
The following example uses the XML file books.xml. External JavaScript is used to load the XML file.
createCDATASection() - Create a CDATA section node
CDATASection Object
The CDATASection object represents a CDATA section in the document.
CDATA sections contain text that will not be parsed by the parser. Tags within a CDATA section are not considered markup, and entities are not expanded. The main purpose is to include materials such as XML fragments without needing 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
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. |