
XML.loaded Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
933
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
XML.load() Method
import XML source code from an external document
Flash 5; security restrictions added in Flash 6
xmlDoc.load(url)
Arguments
url A string specifying the location of the XML document to load.
Description
The load() method imports an external XML document, parses it, converts it into an XML
object hierarchy, and places that hierarchy into
xmlDoc. Any previous contents of xmlDoc are
replaced by the newly loaded XML content. The specified
xmlDoc must be the top-level
node in an XML object hierarchy (i.e., an instance of the XML class, not the XMLnode
class).
Before accessing content imported with load(), we must be sure the load and parsing opera-
tions are complete. To do so, either ...