Android XmlPullParser Move to Next nextStartTag(XmlPullParser pp)

Here you can find the source of nextStartTag(XmlPullParser pp)

Description

call parser nextTag() and check that it is START_TAG, throw exception if not.

Declaration

public static void nextStartTag(XmlPullParser pp)
        throws XmlPullParserException, IOException 

Method Source Code

//package com.java2s;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class Main {
    /**/*from ww w .  ja v a 2 s.com*/
     * call parser nextTag() and check that it is START_TAG, throw exception if not.
     */
    public static void nextStartTag(XmlPullParser pp)
            throws XmlPullParserException, IOException {
        if (pp.nextTag() != XmlPullParser.START_TAG) {
            throw new XmlPullParserException("expected START_TAG and not "
                    + pp.getPositionDescription());
        }
    }

    /**
     * combine nextTag(); pp.require(XmlPullParser.START_TAG, null, name);
     */
    public static void nextStartTag(XmlPullParser pp, String name)
            throws XmlPullParserException, IOException {
        pp.nextTag();
        pp.require(XmlPullParser.START_TAG, null, name);
    }

    /**
     * combine nextTag(); pp.require(XmlPullParser.START_TAG, namespace, name);
     */
    public static void nextStartTag(XmlPullParser pp, String namespace,
            String name) throws XmlPullParserException, IOException {
        pp.nextTag();
        pp.require(XmlPullParser.START_TAG, namespace, name);
    }
}

Related

  1. nextEndTag(XmlPullParser pp)
  2. nextEndTag(XmlPullParser pp)
  3. nextEndTag(XmlPullParser pp, String namespace, String name)
  4. nextEndTag(XmlPullParser pp, String namespace, String name)
  5. nextLong(XmlPullParser parser, String tag)
  6. nextStartTag(XmlPullParser pp)
  7. nextStartTag(XmlPullParser pp, String name)
  8. nextStartTag(XmlPullParser pp, String name)
  9. nextStartTag(XmlPullParser pp, String namespace, String name)