Name

createTextNode: data

Synopsis

This creates a new Text node that contains the given data string.

Argument

data: DOMString

The string that will be the contents of the new node.

Java binding

public Text createTextNode(String data);

Java example

// Create a new node that contains character data
Text txtDesc = doc.createTextNode(
"Character data contents for a new Element.");

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.