smartclient框架组件介绍1(Timer,json处理工具,XMLTools)
来源:互联网 发布:带访客网络的路由器 编辑:程序博客网 时间:2024/06/05 09:47
Timer:定时器组件
定时器组件,用于设定定时执行任务。
组件属性、方法清单
方法
名称/描述
setTimeout
设置定时任务
timerEvent setTimeout (action:String, delay:Number)
clear
清除定时任务
void clear (timerEvent:Number)
setTimeout方法
详述
方法名
setTimeout
概述
设置定时任务。
返回
timerEvent: Object定时任务事件。。
参数
参数
说明
action : String
定时任务函数或表达式。
delay : Number
延迟多长时间启动定时任务。
使用示例
isc.Timer.setTimeout(this.ID + ".recoverState()", 70);
clear方法
详述
方法名
clear
概述
设置定时任务。
返回
无。
参数
参数
说明
timerEvent: Object
定时任务事件。
使用示例
var timerEvent=Timer.setTimeout(".recoverState()", 70);
Timer.clear(timerEvent);
JSON:json处理工具
json处理工具。
组件属性、方法清单
方法
名称/描述
encode
把对象序列化成json字符串。
String encode (object:Object)
decode
将json字符串反序列化为对象
Object decode (jsonString:String)
使用示例
varstr=isc.JSON.encode(button1);
varobj2=isc.JSON.decode("{id1:'zongying',name:'lllll'}");
varstr2=isc.JSON.encode(obj2);
varobj2=isc.JSON.decode(str2)
isc.Log.echo(obj2)
XMLTools
Smartclient提供解析操作xml文档的工具类。该工具类提供可以跨浏览器的api。
相关联的两个类是:XMLDocument和XMLElement
组件属性、方法清单
方法
名称/描述
parseXML
XMLDocument parseXML (xmlText:String)
根据xml字符串文本解析生成dom文档对象
selectNodes
Array selectNodes (element, expression[, namespaces])
以一个xml文档节点为根,使用xpath查找符合条件的xml子节点
serializeToString
String serializeToString (inputDocument)
将dom文档对象序列化成xml字符串文本
toJS
Object toJS (element)
将xml文档节点对象转为javascript对象。
selectNodes方法
详述
方法名
selectNodes
概述
以一个文档节点为根,使用xpath查找符合条件的子节点
返回
Array:符合条件的xml子节点集合
参数
参数
说明
element:XMLElement或 XMLDocument
指定选择的文档父节点。
参数类型XMLDocument,XMLElement都是对浏览器实现的原生xml文档对象的引用。他们可以作为XMLTools的 参数或者返回值。
expression:String
指定xpath表达式作为查找条件。
Namespaces:(可选)
元素的xml命名空间
使用示例
//xml文本
varxmlstr=
'<root>’+
‘<person name="zongying" age="40" />’+
‘<person name="fengbing" age="30"/>’+
‘</root>'
//解析xml字符串
doc=isc.XMLTools.parseXML(xmlstr);
//使用xpath选择xml节点"person",返回一个符合条件的列表
list=isc.XMLTools.selectNodes(doc,"/root/person");
for(vari=0;i<list.length;i++){
//取得xml节点"name"属性
document.write(list[i].getAttribute("name")+",");
}
//选择符合条件的person ,过滤条件:@name="zongying" and @age>30
list2=isc.XMLTools.selectNodes(doc,'/root/person[@name="zongying" and @age>30]');
log(list2[0].getAttribute("name"));
//将xml文档对象序列化为xml字符串
alert(isc.XMLTools.serializeToString(doc));
//将xml字符串转为json字符串
varjsonObj=isc.XMLTools.toJS(list[0]);
log(jsonObj.name+","+jsonObj.age);
toJS方法
详述
方法名
toJS
概述
将xml文档节点对象转为javascript对象。例如
<foo bar="zoo">
<x>y</x>
</foo>
将被转换为:
{ bar:"zoo", x:"y"}
返回
Object:JavaScript对象
参数
参数
说明
element:XMLElement或 XMLDocument
指定选择的文档父节点。
参数类型XMLDocument,XMLElement都是对浏览器实现的原生xml文档对象的引用。他们可以作为XMLTools的 参数或者返回值。
- smartclient框架组件介绍1(Timer,json处理工具,XMLTools)
- smartclient框架组件介绍2(UploadForm,PageListGrid)
- smartclient框架组件介绍4(ResourceTreeGrid,HTMLPane)
- smartclient框架组件介绍3(Menu,MenuItem,MenuButton)
- smartclient框架组件介绍5(Img,Label,IButton,ToolStrip)
- smartclient框架组件介绍6(DynamicForm,FormItem,FormItemType)
- smartclient框架组件介绍7(Canvas,TabSet,Window)
- smartclient框架组件介绍8(ListGrid,TreeGrid,Tree)
- smartclient框架组件介绍9(GraphPie,GraphBar,GraphLine)
- smartclient框架组件介绍10(GraphMeter,GraphMeter2,GraphBarVsLine)
- XMLTools
- SmartClient 介绍
- SmartClient组件使用
- SmartClient组件简介
- SmartClient新建组件实例
- Matlab处理Timer工具函数
- SmartClient Ajax平台介绍
- 命令行 JSON 处理工具 jq 的使用介绍
- LinQ To Object 基本用法
- POJ 1564 - Sum It Up
- Get Started With Tiny_MCE
- KissXml 配置
- google map 密匙获取小结
- smartclient框架组件介绍1(Timer,json处理工具,XMLTools)
- vc++源码免杀思路 学了免杀并不难
- 二进制转换为十进制(包括小数转换)
- Android 中的 Service 全面总结
- Linux环境下段错误的产生原因及调试方法小结
- TBXML常用API
- WebView cookies清理
- ftp 上传文件后文件名为pureftpd-upload.xxxxxx
- likely和unlikely宏