METHOD:  CharacterData::appendData

CharacterData.appendData(data)

The appendData method appends the specified string to existing string data.

In the following example using the 'capitals.xml' file the code appends the characters ' DC' to the text of the last 'capital' element (Washington).

XML:
<capitals>
   <capital>Beijing</capital>
   <capital>Berlin</capital>
   <capital>London</capital>
   <capital>Paris</capital>
   <capital>Washington</capital>
</capitals>

Code (JavaScript):
xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("capitals.xml");

text = xml_doc.documentElement.lastChild.firstChild;
text.appendData(" DC");
document.write(text.data);

Output:
Washington DC



Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information