Name

appendData: arg

Synopsis

This method appends contents of the arg parameter to the current contents of the data attribute.

Argument

arg: DOMString

The string to append.

Exception

NO_MODIFICATION_ALLOWED_ERR

Raised if this node is read-only.

Java binding

public void appendData(String arg) throws DOMException;

Java example

// Append to an existing string
// Create a new Text object and reference the CharacterData interface
     
CharacterData ndCD = (CharacterData)doc.createTextNode("The truth is ");
// flip a coin
     
ndCD.appendData((Math.random( ) < 0.5) ? "out there." : "in here.");
System.out.println(ndCD.getData( ));

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.