【函数】 | boolean parse(String xmlCode, boolean showProgress) |
【说明】 | 解析XML代码,解析成功后当前对象为根对象。 |
【返回】 | 成功或失败。 |
【参数】 | xmlCode:要解析的XML代码。 showProgress:是否显示进度条。 |
【示例】 |
alert(rexseeXML.parse(rexseeAjax.syncSubmit('/Eric/test.xml','','UTF-8'),true));
运行示例
|
【函数】 | String getVersion() |
【说明】 | 读取XML版本,必须在调用parse()后才有效。 |
【返回】 | XML版本。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getVersion());
运行示例
|
【函数】 | String getEncoding() |
【说明】 | 读取XML中指定编码,必须在调用parse()后才有效。 |
【返回】 | XML编码。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getEncoding());
运行示例
|
【函数】 | int getMaxDepth() |
【说明】 | 读取XML的最大深度,必须在调用parse()后才有效。 |
【返回】 | 最大深度。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getMaxDepth());
运行示例
|
【函数】 | JsonObjectArray getNameSpaces() |
【说明】 | 读取XML中包含的所有名字空间,必须在调用parse()后才有效。 |
【返回】 | JSON对象,使用eval('('+json+')')转换为JavaScript对象。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getNameSpaces());
运行示例
|
【函数】 | JsonObject getJson() |
【说明】 | 将当前对象转换为JSON字符串,必须在调用parse()后才有效。 |
【返回】 | JSON对象字符串,使用eval('('+json+')')转换为JavaScript对象。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getJson());
运行示例
rexseeXML.goToRoot();
运行示例
alert(eval('('+rexseeXML.getJson()+')').childs[0].childs[1].childs[0].childs[0].childs[1].attributes.android__name); |
【函数】 | String getTagName() |
【说明】 | 读取当前对象的标签名称,必须在调用parse()后才有效。 |
【返回】 | 标签名称。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getTagName());
运行示例
|
【函数】 | String getType() |
【说明】 | 读取当前对象的类型名称,可能的类型包括“root”(根节点)、“tag”、“text”、“cdsect”或“comment”,必须在调用parse()后才有效。 |
【返回】 | 类型名称。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getType());
运行示例
|
【函数】 | int getDepth() |
【说明】 | 读取当前对象的深度,必须在调用parse()后才有效。 |
【返回】 | 深度。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getDepth());
运行示例
|
【函数】 | String getAttribute(String attributeName) |
【说明】 | 读取当前对象的某个属性,必须在调用parse()后才有效。 |
【返回】 | 属性的值。 |
【参数】 | attributeName:属性名称。 |
【示例】 |
rexseeXML.goToRoot();
运行示例
rexseeXML.goToChild(0); alert(rexseeXML.getAttribute('package')); |
【函数】 | String getText() |
【说明】 | 读取当前对象的文本,只有当类型为“text”、“cdsect”或者“comment”时才有效,必须在调用parse()后才有效。 |
【返回】 | 文本。 |
【参数】 | 无 |
【示例】 |
rexseeXML.goToRoot();
运行示例
rexseeXML.goToChild(0); rexseeXML.goToChild(2); alert(rexseeXML.getText()); |
【函数】 | boolean goToRoot() |
【说明】 | 令当前对象等于根对象,必须在调用parse()后才有效。 |
【返回】 | true或false。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.goToRoot());
运行示例
|
【函数】 | boolean hasParent() |
【说明】 | 判断当前对象是否有父对象,必须在调用parse()后才有效。 |
【返回】 | true或false。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.hasParent());
运行示例
|
【函数】 | int getIndexOf() |
【说明】 | 读取当前对象在父对象中的排序,必须在调用parse()后才有效。 |
【返回】 | 在父对象中的排序。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getIndexOf());
运行示例
|
【函数】 | boolean goToParent() |
【说明】 | 令当前对象等于父对象,必须在调用parse()后才有效。 |
【返回】 | true或false。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.goToParent());
运行示例
|
【函数】 | int getChildLength() |
【说明】 | 读取当前对象的子对象的个数,必须在调用parse()后才有效。 |
【返回】 | 子对象个数。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.getChildLength());
运行示例
|
【函数】 | boolean goToChild(String index) |
【说明】 | 令当前对象等于index指向的子对象,必须在调用parse()后才有效。 |
【返回】 | true或false。 |
【参数】 | index:子对象的序号。 |
【示例】 |
alert(rexseeXML.goToChild(0));
运行示例
|
【函数】 | boolean goToNextSibling() |
【说明】 | 令当前对象等于下一个兄弟对象,必须在调用parse()后才有效。 |
【返回】 | true或false。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.goToNextSibling());
运行示例
|
【函数】 | boolean goPreviousSibling() |
【说明】 | 令当前对象等于上一个兄弟对象,必须在调用parse()后才有效。 |
【返回】 | true或false。 |
【参数】 | 无 |
【示例】 |
alert(rexseeXML.goPreviousSibling());
运行示例
|
【函数】 | int getListByAttribute(String attributeName, String attributeValue) |
【说明】 | 读取指定属性等于指定值的对象并生成一个列表,必须在调用parse()后才有效。 |
【返回】 | 列表中的对象个数。 |
【参数】 | attributeName:属性名称。 attributeValue:属性值。 |
【示例】 |
alert(rexseeXML.getListByAttribute('id','test_id'));
运行示例
|
【函数】 | int getListByTagName(String tagName) |
【说明】 | 读取指定标签名称的对象并生成一个列表,必须在调用parse()后才有效。 |
【返回】 | 列表中的对象个数。 |
【参数】 | tagName:标签名称。 |
【示例】 |
alert(rexseeXML.getListByTagName('uses-permission'));
运行示例
|
【函数】 | int getListByType(String type) |
【说明】 | 读取指定类型名称的对象并生成一个列表,可能的类型包括“root”(根节点)、“tag”、“text”、“cdsect”或“comment”,必须在调用parse()后才有效。 |
【返回】 | 列表中的对象个数。 |
【参数】 | type:类型名称。 |
【示例】 |
alert(rexseeXML.getListByType('tag'));
运行示例
|
【函数】 | int getListByDepth(int depth) |
【说明】 | 读取指定深度的对象并生成一个列表,必须在调用parse()后才有效。 |
【返回】 | 列表中的对象个数。 |
【参数】 | depth:深度。 |
【示例】 |
alert(rexseeXML.getListByDepth(5));
运行示例
|
【函数】 | int getListLength() |
【说明】 | 由函数getListByAttribute()、getListByTagName()、getListByType()、getListByDepth()获取的列表中对象的个数。 |
【返回】 | 对象个数。 |
【参数】 | 无 |
【示例】 |
rexseeXML.getListByDepth(5);
运行示例
alert(rexseeXML.getListLength()); |
【函数】 | boolean goToList(String index) |
【说明】 | 令当前对象等于由函数getListByAttribute()、getListByTagName()、getListByType()、getListByDepth()获取的列表中index指向的对象。 |
【返回】 | true或false。 |
【参数】 | index:列表中对象的序号。 |
【示例】 |
rexseeXML.getListByDepth(5);
运行示例
rexseeXML.goToList(0); alert(rexseeXML.getJson()); |