Android XmlPullParser Skip skip(XmlPullParser parser)

Here you can find the source of skip(XmlPullParser parser)

Description

Skips the next tag and all of its children

Declaration

public static void skip(XmlPullParser parser)
        throws XmlPullParserException, IOException 

Method Source Code

//package com.java2s;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

public class Main {
    /**/*from   ww w. j  a v a 2 s .  c  om*/
     * Skips the next tag and all of its children
     */
    public static void skip(XmlPullParser parser)
            throws XmlPullParserException, IOException {

        if (parser.getEventType() != XmlPullParser.START_TAG) {
            throw new IllegalStateException();
        }
        int depth = 1;
        while (depth != 0) {
            switch (parser.next()) {
            case XmlPullParser.END_TAG:
                depth--;
                break;
            case XmlPullParser.START_TAG:
                depth++;
                break;
            }
        }
    }
}

Related

  1. skip(XmlPullParser parser)
  2. skip(XmlPullParser parser)
  3. skipCurrentTag(XmlPullParser parser)
  4. skipCurrentTag(XmlPullParser parser)