User Guide
440 Chapter 12: Methods
parseURL()
Usage
parserObject.parseURL(URLstring {,#handlerToCallOnCompletion} {,
objectContainingHandler})
Description
Function; parses an XML document that resides at an external Internet location. The first
parameter is the parser object containing an instance of the XML Parser Xtra.
This function returns immediately, so the entire URL may not yet be parsed. It is important to
use the
doneParsing() function in conjunction with parseURL() to determine when the
parsing operation is complete.
Since this operation is asynchronous, meaning it may take some time, you can use optional
parameters to call a specific handler when the operation completes.
The return value is void if the operation succeeds, or an error code number string if it fails.
To parse XML locally, use
parseString().
Parameters
URLstring
Required. Specifies the actual URL at which the XML data resides.
handlerToCallOnCompletion Optional. Specifies the name of the handler that is to be executed
once the URL is fully parsed.
objectContainingHandler Optional. Specifies the name of the script object containing the
handler
handlerToCallOnCompletion. If omitted, the handler is assumed to be a movie handler.
Example
This statement parses the file sample.xml at MyCompany.com. Use doneParsing() to determine
when the parsing operation has completed.
--Lingo syntax
errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml")
// JavaScript syntax
errorCode = _global.gParserObject.parseURL("http://- www.MyCompany.com/
sample.xml");
Note: This example supposes that an instance of the Xtra has already been created, and a reference
to that has been stored in the global variable named gParserObject.
This Lingo parses the file sample.xml and calls the on parseDone handler. Because no script
object is given with the
doneParsing() function, the on parseDone handler is assumed to be in
a movie script.
errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml",
#parseDone)