XMLNode
1337
Example
The following example is an excerpt from the example for the
XML.lastChild
property, and
shows how you can use the
XML.previousSibling
property to loop through an XML node's
child nodes:
for (var aNode:XMLNode = rootNode.lastChild; aNode != null; aNode =
aNode.previousSibling) {
trace(aNode);
}
See also
lastChild (XMLNode.lastChild property)
,
appendChild (XMLNode.appendChild
method)
,
insertBefore (XMLNode.insertBefore method)
,
removeNode
(XMLNode.removeNode method)
,
XML
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" />
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...