Here you can find the source of nextElementWithin(XmlPullParser parser, int outerDepth)
public static boolean nextElementWithin(XmlPullParser parser, int outerDepth) throws IOException, XmlPullParserException
//package com.java2s; import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; public class Main { public static boolean nextElementWithin(XmlPullParser parser, int outerDepth) throws IOException, XmlPullParserException { for (;;) { int type = parser.next(); if (type == XmlPullParser.END_DOCUMENT || type == XmlPullParser.END_TAG && parser.getDepth() == outerDepth) { return false; }/* w ww. ja v a 2 s . co m*/ if (type == XmlPullParser.START_TAG && parser.getDepth() == outerDepth + 1) { return true; } } } }