May 2001
Intermediate to advanced
720 pages
23h 24m
English
XML.lastChild Property — a reference to the last descendant of a node
Flash 5
theNode.lastChild
Read-only
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>
// 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
XML
.childNodes,
XML
.firstChild,
XML
.nextSibling,
XML
.previousSibling
Read now
Unlock full access