设为首页 加入收藏

TOP

PULL解析XML的运行机制详解(二)
2015-08-31 21:23:50 来源: 作者: 【 】 浏览:66
Tags:PULL 解析 XML 运行 机制 详解
的。其中包括:START_TAG, TEXT, END_TAG, END_DOCUMENT
nextToken():返回所有事件。
While next() provides access to high level parsing events, nextToken() allows access to lower level tokens.


5) void require(int type,String namespace,String name)


Test if the current event is of the given type and if the
namespace and name do match. null will match any namespace and any name. If the current event is TEXT with isWhitespace()= true, and the required type is not TEXT, next () is called prior to the test.
//测试当前事件是给定事件类型。Namespace,name是null表示任意匹配。
如果当前事件是Text且为空,required type不是text,那么就会调用next()


if (getEventType() == TEXT && type != TEXT && isWhitespace ())
next ();


if (type != getEventType()
|| (namespace != null && !namespace.equals (getNamespace ()))
|| (name != null && !name.equals (getName ()))
throw new XmlPullParserException ( “expected “+ TYPES[ type ]+getPositionDesctiption());


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇在Android用Get方式发送HTTP请求 下一篇Python中异常(Exception)的总结

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: