require
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 test is not passed, an exception is thrown. The exception text indicates the parser position, the expected event and the current event that is not meeting the requirement.
Essentially it does this
if (type != eventType
|| (namespace != null && !namespace.equals(getNamespace()))
|| (name != null && !name.equals( getName())))
throw new XmlPullParserException("Expected " + TYPES[type] + getPositionDescription());Content copied to clipboard