PULL解析XML的运行机制详解(2)

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());

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/f557a694cf2f64b01dd0c676118cabd3.html