Here you can find the source of beginDocument(XmlPullParser parser, String firstElementName)
@SuppressWarnings("static-access") public static final void beginDocument(XmlPullParser parser, String firstElementName) throws XmlPullParserException, IOException
//package com.java2s; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; public class Main { @SuppressWarnings("static-access") public static final void beginDocument(XmlPullParser parser, String firstElementName) throws XmlPullParserException, IOException {// w w w . j a v a2 s.co m int type; while ((type = parser.next()) != parser.START_TAG && type != parser.END_DOCUMENT) { ; } if (type != parser.START_TAG) { throw new XmlPullParserException("No start tag found"); } if (!parser.getName().equals(firstElementName)) { throw new XmlPullParserException("Unexpected start tag: found " + parser.getName() + ", expected " + firstElementName); } } }