Code example for XmlPullParserException

0
    public void require(int type, String namespace, String name)
        throws XmlPullParserException, IOException { 
      if (type != getEventType()
          || (namespace != null && !namespace.equals(getNamespace()))
          || (name != null && !name.equals(getName()))) {
        throw new XmlPullParserException(
            "expected " + TYPES[type] + getPositionDescription());
      } 
    } 
 
    public String nextText() throws XmlPullParserException, IOException {
      if (getEventType() != START_TAG) {
        throw new XmlPullParserException(
            getPositionDescription() 
                + ": parser must be on START_TAG to read next text", this, null);
      } 
      int eventType = next();
      if (eventType == TEXT) {
        String result = getText();
        eventType = next();
        if (eventType != END_TAG) {