Easy Tutorial
❮ Prop Documenttype Name Prop Attr Ownerelement ❯

XML DOM data Attribute



Definition and Usage

The data attribute sets or returns the text of a comment.

Syntax


Example

The following code snippet uses loadXMLDoc() to load "books_comment.xml" into xmlDoc and outputs the comment text of the first <book> element:

Example

The above code will 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 Documenttype Name Prop Attr Ownerelement ❯