
XML.onData() Event Handler
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
938
|
ActionScript Language Reference
•IftheNode is an element node, nodeValue is null.
•If
theNode is a text node, nodeValue is the text contained by the node.
To assign new text to an existing text node, we use
nodeValue as follows:
// Create a new XML document
myDoc = new XML('<H1>first heading</H1><P>content</P>');
// Change the text contained by the H1 tag
myDoc.firstChild.firstChild.nodeValue = "My Life Story";
To retrieve the text of a text node, we simply read its nodeValue property:
trace(myDoc.firstChild.firstChild.nodeValue);
Note that, in nodeValue, the predefined entities <, >, &, ", and ' are
represented as the literal characters <, >, &, ", and '. To obtain the source code for a node,
including uninterpreted entities, use XML.toString(). For more details, see XML.
parseXML().
When a node is used in a string context, Flash uses XML.toString(), not
nodeValue,to
represent its value:
// Force an implicit datatype conversion. Calls toString().
trace(myDoc.firstChild.firstChild);
// Same as:
trace(myDoc.firstChild.firstChild.toString());
See Also
XML.nodeName, XML.nodeType, XML.parseXML(), XML.toString()
XML.onData() Event Handler
executed when external XML source code finishes loading but has not yet been parsed
Flash 5
xmlDoc.onData(src);
Arguments ...