The replaceData() method replaces data in a CDATA node.
Parameter | Description |
---|---|
start | Required. Specifies where to begin replacing characters. Start value starts at zero |
length | Required. Specifies how many characters to replace |
string | Required. Specifies the string to insert |
The following code fragment loads "books_cdata.xml" into xmlDoc using loadXMLDoc() and replace "Stunning" with "Fantastic" in the CDATA node of the first <html> element:
Output: