XML.childNodes
Availability
Flash Player 5.
Usage
my_xml.childNodes:Array
Description
Read-only property; an array of the specified XML object's children. Each element in the array is
a reference to an XML object that represents a child node. This is a read-only property and
cannot be used to manipulate child nodes. Use the XML.appendChild(), XML.insertBefore(),
and
XML.removeNode()
This property is undefined for text nodes (
Example
The following example shows how to use the
child nodes:
// create a new XML document
var doc:XML = new XML();
// create a root node
var rootNode:XMLNode = doc.createElement("rootNode");
// create three child nodes
var oldest:XMLNode = doc.createElement("oldest");
var middle:XMLNode = doc.createElement("middle");
var youngest:XMLNode = doc.createElement("youngest");
// add the rootNode as the root of the XML document tree
doc.appendChild(rootNode);
// add each of the child nodes as children of rootNode
rootNode.appendChild(oldest);
rootNode.appendChild(middle);
rootNode.appendChild(youngest);
// create an array and use rootNode to populate it
var firstArray:Array = doc.childNodes;
trace (firstArray);
// output: <rootNode><oldest /><middle /><youngest /></rootNode>
// create another array and use the child nodes to populate it
var secondArray:Array = rootNode.childNodes;
trace(secondArray);
// output: <oldest />,<middle />,<youngest />
See also
XML.nodeType
1016
Chapter 2: ActionScript Language Reference
methods to manipulate child nodes.
nodeType ==
XML.childNodes
3).
property to return an array of
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?