Here you can find the source of getRequiredAttributeValue(XmlPullParser pp, String namespace, String name)
public static String getRequiredAttributeValue(XmlPullParser pp, String namespace, String name) throws IOException, XmlPullParserException
//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 { /**// www.j av a2s .c o m * Read attribute value and return it or throw exception if * current element does not have such attribute. */ public static String getRequiredAttributeValue(XmlPullParser pp, String namespace, String name) throws IOException, XmlPullParserException { String value = pp.getAttributeValue(namespace, name); if (value == null) { throw new XmlPullParserException("required attribute " + name + " is not present"); } else { return value; } } /** * Return value of attribute with given name and no namespace. */ public static String getAttributeValue(XmlPullParser pp, String name) { return pp.getAttributeValue(XmlPullParser.NO_NAMESPACE, name); } }