home *** CD-ROM | disk | FTP | other *** search
- class CXML extends XML
- {
- var oResult;
- var cbfunc;
- function CXML()
- {
- super();
- }
- function onLoad(bSuccess)
- {
- if(bSuccess)
- {
- this.parse(this,this.oResult = new Object());
- }
- return this.cbfunc(bSuccess);
- }
- function parse(node, oRes)
- {
- node.ignoreWhite = true;
- var _loc2_ = 0;
- while(_loc2_ < node.childNodes.length)
- {
- if(node.childNodes[_loc2_].childNodes.length > 1)
- {
- this.parse(node.childNodes[_loc2_],oRes[node.childNodes[_loc2_].nodeName] = new Object());
- }
- else if(node.childNodes[_loc2_].hasChildNodes())
- {
- switch(node.childNodes[_loc2_].attributes.type)
- {
- case "Number":
- var _loc4_ = Number(node.childNodes[_loc2_].firstChild.nodeValue);
- break;
- case "nArray":
- _loc4_ = this.conv2NumAr(node.childNodes[_loc2_].firstChild.nodeValue.split(node.childNodes[_loc2_].attributes.separator));
- break;
- case "sArray":
- _loc4_ = node.childNodes[_loc2_].firstChild.nodeValue.split(node.childNodes[_loc2_].attributes.separator);
- break;
- default:
- _loc4_ = node.childNodes[_loc2_].firstChild.nodeValue;
- }
- oRes[node.childNodes[_loc2_].nodeName] = _loc4_;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function conv2NumAr(ar)
- {
- var _loc1_ = 0;
- while(_loc1_ < ar.length)
- {
- ar[_loc1_] = Number(ar[_loc1_]);
- _loc1_ = _loc1_ + 1;
- }
- return ar;
- }
- }
-