Here you can find the source of beginDocument(XmlPullParser parser, String firstElementName)
public static final void beginDocument(XmlPullParser parser, String firstElementName) throws XmlPullParserException, IOException
//package com.java2s; import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; public class Main { public static final void beginDocument(XmlPullParser parser, String firstElementName) throws XmlPullParserException, IOException {/*from w ww. j a v a 2s . com*/ int type; while ((type = parser.next()) != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT) { ; } if (type != XmlPullParser.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); } } }