Access keys

LoadVarsXML

Kind of class: class
Inherits from: Dispatcher
Classpath: org.asapframework.data.loader.LoadVarsXML
File last modified: Wednesday, 11 October 2006, 21:56:59
Class to make XML based LoadVars requests with.
This class will automatically parse all data to native objects and store this in the .result getter
This class can be used to load dynamic, parameter-based XML, or post forms that expect XML as response.
See also:
DataLoader for usage of this class. The DataLoader forms a wrapper for this class.
Usage:
This example code is taken from the DataLoader class:
private function DataLoader() {
    super();

    // create xml loader with post data, listen to events
    mPostXMLLoader = new LoadVarsXML();
    mPostXMLLoader.addEventListener(LoadVarsXML.EVENT_DONE, EventDelegate.create(this, handlePostDone));
    mPostXMLLoader.addEventListener(LoadVarsXML.EVENT_ERROR, EventDelegate.create(this, handlePostError));
}

// Handle done event from the postXMLLoader
private function handlePostDone () : Void {
    handleDataLoaded(mPostXMLLoader.result, mPostXMLLoader.urlData.name);
}

// Handle error while loading from the postXMLLoader
private function handlePostError () : Void {
    Log.error("handlePostError: error loading '" + mPostXMLLoader.urlData.name + "'", toString());
}

// Handle event that data has been loaded
private function handleDataLoaded (inData:Object, inName:String) : Void {
    Log.info("handleDataLoaded: done loading '" + mPostXMLLoader.urlData.name + "'", toString());
}

Summary

Constructor

LoadVarsXML

function LoadVarsXML (
)
Constructor (private)

Class properties

EVENT_DONE

static EVENT_DONE:String = "onLoadVarsRequestDone"
(read,write)

EVENT_ERROR

static EVENT_ERROR:String = "onLoadVarsRequestError"
(read,write)

GET

static GET:String = "GET"
(read,write)

POST

static POST:String = "POST"
(read,write)
Types of post

Instance properties

pending

pending:Boolean
(read)
True if a call is already being exeuted

result

result:Object
(read)
The result of the operation

type

type
(write)
Sets the request type, either LoadVarsXML.POST (default) or LoadVarsXML.GET

urlData

urlData:URLData
(read)
The URLData object as passed in the execute call

Instance methods

load

function load (
inURLData:URLData, inRequest:LoadVars, inType:String) : Boolean
Executes a request
Parameters:
inURLData:
data block containing name and url
inRequest:
LoadVars object containing all the POST data
inType :
type of post, either POST or GET
Returns:
true if the process was started successfully, otherwise false

toString

function toString (
) : String
Returns:
Package and class name