Easy Tutorial
❮ Dom Nodes Create Dom Nodetree ❯

XML DOM insertData() Method


Definition and Usage

The insertData() method inserts data into a comment node.

Syntax

Parameter Description
start Required. Specifies where to start inserting characters. The starting value is 0.
string Required. Specifies the string to insert.

Example

The following code snippet uses loadXMLDoc() to load "books_comment.xml" into xmlDoc and inserts a string into the first comment node:

Example

Output:

In the above example, we use a loop and an if statement to perform processing specifically for comment nodes. The node type for comment nodes is 8.


❮ Dom Nodes Create Dom Nodetree ❯