Name

XML.load( ) Method — import XML source code from an external document

Availability

Flash 5

Synopsis

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.

XMLdoc must be an instance of the XML class, not the XMLnode class.

Usage

Before accessing content imported with load( ), we must be sure the load and parsing operations are complete. To do so, either check the value of the XML document’s loaded property, or assign the document an onLoad( ) callback handler to respond to the load completion. See the XML .loaded and XML.onLoad( ) entries for details. To determine whether the loaded data was successfully parsed, check the document’s status property.

XML.load( ) is subject to the domain-based security restrictions described in Table 20.8 under the global loadVariables( ) function.

Example

myDoc = new XML( );
myDoc.load("myData.xml");

See Also

XML .loaded, XML.onLoad( ), XML.sendAndLoad( ), XML .status

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.