Code example for XmlPullParserException

0
      } 
    } 
 
    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) {
          throw new XmlPullParserException(
              getPositionDescription() 
                  + ": event TEXT it must be immediately followed by END_TAG", this, null);
        } 
        return result;
      } else if (eventType == END_TAG) {
        return "";