Name
XML.lastChild Property — a reference to the last descendant of a node
Availability
Flash 5
Synopsis
theNode.lastChild
Access
Read-only
Description
The lastChild
property is synonymous with
childNodes[childNodes.length-1]
. It returns a
reference to the last node object that descends from
theNode
. If
theNode
has no children,
lastChild
returns null
.
In the following XML source fragment, the
lastChild
of the MESSAGE
node
is the CONTENT
node:
<MESSAGE><USER>gray</USER><CONTENT>hi</CONTENT></MESSAGE>
Example
// Create a new XML document myDoc = new XML('<MESSAGE><USER>gray</USER><CONTENT>hi</CONTENT></MESSAGE>'); // Sets msg to "hi" because myDoc's firstChild // is MESSAGE, MESSAGE's lastChild is CONTENT, and CONTENT's firstChild // is the text node with the value "hi" msg = myDoc.firstChild.lastChild.firstChild.nodeValue
See Also
XML
.childNodes
,
XML
.firstChild
,
XML
.nextSibling
,
XML
.previousSibling
Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.