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.

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;
// for license please see accompanying LICENSE.txt file (available also at http://www.xmlpull.org/)

import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class Main {
    /**//from ww w  . j av  a 2 s. c om
     * 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, String namespace, String name)
  3. nextEndTag(XmlPullParser pp, String namespace, String name)
  4. nextLong(XmlPullParser parser, String tag)
  5. nextStartTag(XmlPullParser pp)
  6. nextStartTag(XmlPullParser pp, String name)
  7. nextStartTag(XmlPullParser pp, String name)
  8. nextStartTag(XmlPullParser pp, String namespace, String name)
  9. nextStartTag(XmlPullParser pp, String namespace, String name)