Here you can find the source of readAttribute(XmlPullParser parser, String tag, String attributeName)
Parameter | Description |
---|---|
parser | a parameter |
tag | a parameter |
attributeName | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
XmlPullParserException | an exception |
public static String readAttribute(XmlPullParser parser, String tag, String attributeName) throws IOException, XmlPullParserException
//package com.java2s; import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; public class Main { private static final String NULL = null; /**/* ww w. j ava2 s. co m*/ * * @param parser * @param tag * @param attributeName * @return String * @throws IOException * @throws XmlPullParserException */ public static String readAttribute(XmlPullParser parser, String tag, String attributeName) throws IOException, XmlPullParserException { parser.require(XmlPullParser.START_TAG, NULL, tag); String attributeData = parser .getAttributeValue(NULL, attributeName); parser.nextTag(); parser.require(XmlPullParser.END_TAG, NULL, tag); return attributeData; } }