com.judah.controls.dataproviders
class XMLToRecordset
Object
|
+--com.judah.controls.dataproviders.XMLToRecordset
class XMLToRecordset extends Object
XML to Recordset class
This class is used to convert a xml tree node into a recordset
- Author:Judah Frangipane
Method Summary
public static convertToItem (
theNode, labelField, createLabelField
)
A user customizable function to convert a xml node into a row item
Parses an xml dom into a recordset
Method Documentation
convertToItem
public static function convertToItem (
theNode,
labelField,
createLabelField)
labelField,
createLabelField)
A user customizable function to convert a xml node into a row item
A user customizable function to convert a xml node into a row item
- Parameters:
theNode Object - The xml node that will be converted into a row item labelField String - Field in the database that should be used as the labelField as defined in the grid or list createLabelField Boolean - Takes field in the database defined as the labelField and copies that value into the "label" property. Default value is false. Optional
parse
public static function parse (
xmlObject,
labelField: String,
createLabelField: Boolean)
labelField: String,
createLabelField: Boolean)
Parses an xml dom into a recordset
Parses an xml dom into a recordset
- Parameters:
xmlObject Object - This is usually the parent node of the child nodes you want to use labelField String - Field in the database that should be used as the labelField as defined in the tree createLabelField Boolean - Takes field in the database defined as the labelField and copies that value into the "label" attribute. Default value is false. Optional - Returns:Object - Returns an recordset ready to assign to a list or datagrid dataprovider
- Usage:listComponent.dataProvider = XMLToRecordset.parse(xmlDB.firstChild, "label", true);
- Example:This code parses a xml object and places it into a grid
import XMLToRecordset; //::Define XML object to load the external data xmlDB = new XML(); xmlDB.ignoreWhite = true; // load data xmlDB.load("testdata.xml"); xmlDB.onLoad = function() { // pass in the firstchild node of the xml object to the XMLToRecordset transmogrification class theDataGrid.dataProvider = XMLToRecordset.parse(xmlDB.firstChild, "label", true); }
- XMLToRecordset.as, Last Modified: 5/21/2006 10:52:26 PM