Easy Tutorial
❮ Prop Element Ownerdocument Prop Element Attributes ❯

XML DOM substringData() Method



Definition and Usage

The substringData() method retrieves a string from a comment node.

Syntax

Parameter Description
start Required. Specifies where to start extracting characters. The start value begins at 0.
length Required. Specifies how many characters to extract.

Example

The following code snippet uses loadXMLDoc() to load "books_comment.xml" into xmlDoc and retrieves the string "(Hardcover)" from the first comment element:

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.


❮ Prop Element Ownerdocument Prop Element Attributes ❯