Example
The following example is an excerpt from the example for the
shows how you can use the
child nodes:
for (var aNode:XMLNode = rootNode.lastChild; aNode != null; aNode =
aNode.previousSibling) {
trace(aNode);
}
See also
lastChild (XMLNode.lastChild property)
,
method)
insertBefore (XMLNode.insertBefore method)
(XMLNode.removeNode method)
removeNode (XMLNode.removeNode method)
public removeNode() : Void
Removes the specified XML object from its parent. Also deletes all descendants of the node.
Availability: ActionScript 1.0; Flash Player 5
Example
The following example creates an XML packet, and then deletes the specified XML object
and its descendant nodes:
var xml_str:String = "<state name=\"California\"><city>San Francisco</
city></state>";
var my_xml:XML = new XML(xml_str);
var cityNode:XMLNode = my_xml.firstChild.firstChild;
trace("before XML.removeNode():\n"+my_xml);
cityNode.removeNode();
trace("");
trace("after XML.removeNode():\n"+my_xml);
// output (line breaks added for clarity):
//
// before XML.removeNode():
// <state name="California">
// <city>San Francisco</city>
// </state>
//
// after XML.removeNode():
// <state name="California" />
XML.previousSibling
,
,
XML
XML.lastChild
property to loop through an XML node's
appendChild (XMLNode.appendChild
,
removeNode
property, and
XMLNode
1337
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?
Questions and answers