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.
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
Class properties
- POST : String
- Types of post
- GET : String
- EVENT_DONE : String
- EVENT_ERROR : String
Instance properties
- mResult : Object
- mXMLResultHandler : XML
- mCallPending : Boolean
- mType : String
- mURLData : URLData
- urlData : URLData
- The URLData object as passed in the execute call
- result : Object
- The result of the operation
- pending : Boolean
- True if a call is already being exeuted
- type (inType:String)
- Sets the request type, either LoadVarsXML.POST (default) or LoadVarsXML.GET
Instance properties inherited from Dispatcher
Instance methods
- load (inURLData:URLData, inRequest:LoadVars, inType:String) : Boolean
- Executes a request
- handleRequestDone (inSuccess:Boolean) : Void
- Triggered by mXMLResultHandler.
- toString : String
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
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
Instance methods
handleRequestDone
private function handleRequestDone (
inSuccess:Boolean) : Void
Triggered by mXMLResultHandler.
load
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