User Guide

462
The return value is void if the operation succeeds, or an error code number string if it fails.
To parse XML locally, use
parseString().
Examples
This statement parses the file sample.xml at MyCompany.com. Use doneParsing() to determine
when the parsing operation has completed.
errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml")
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)
The movie script contains the on parseDone handler:
on parseDone
global gParserObject
if voidP(gParserObject.getError()) then
put "Successful parse"
else
put "Parse error:"
put " " & gParserObject.getError()
end if
end
This Lingo parses the document sample.xml at MyCompany.com and calls the on parseDone
handler in the script object
testObject, which is a child of the parent script TestScript:
parserObject = new(xtra "XMLParser")
testObject = new(script "TestScript", parserObject)
errorCode = gParserObject.parseURL("http://www.MyCompany.com/sample.xml",
#parseDone, testObject)
Here is the parent script TestScript:
property myParserObject
on new me, parserObject
myParserObject = parserObject
end
on parseDone me
if voidP(myParserObject.getError()) then
put "Successfull parse"
else
put "Parse error:"
put " " & myParserObject.getError()
end if
end
See also
getError() (XML), parseString()