LoadVarsXML

Kind of class:class
Inherits from:Dispatcher
Classpath:org.asapframework.data.loader.LoadVarsXML
File last modified:Monday, 09 October 2006, 23:33:37
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:
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
Class properties
Instance properties
Instance methods

Constructor

LoadVarsXML

function LoadVarsXML (
)

Constructor (private)

Class properties

EVENT_DONE

static EVENT_DONE:String = "onLoadVarsRequestDone"
(read)

EVENT_ERROR

static EVENT_ERROR:String = "onLoadVarsRequestError"
(read)

GET

static GET:String = "GET"
(read)

POST

static POST:String = "POST"
(read)

Types of post

Instance properties

mCallPending

private mCallPending:Boolean
(read)

mResult

private mResult:Object
(read)

mType

private mType:String = POST
(read)

mURLData

private mURLData:URLData
(read)

mXMLResultHandler

private mXMLResultHandler:XML
(read)

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

handleRequestDone

private function handleRequestDone (
inSuccess:Boolean) : Void

Triggered by mXMLResultHandler.

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