XmlPullParserUtil


@UnstableApi
public final class XmlPullParserUtil


XmlPullParser utility methods.

Summary

Public methods

static @Nullable String
getAttributeValue(XmlPullParser xpp, String attributeName)

Returns the value of an attribute of the current start tag.

static @Nullable String

Returns the value of an attribute of the current start tag.

static boolean

Returns whether the current event is an end tag.

static boolean

Returns whether the current event is an end tag with the specified name.

static boolean

Returns whether the current event is a start tag.

static boolean

Returns whether the current event is a start tag with the specified name.

static boolean

Returns whether the current event is a start tag with the specified name.

Public methods

getAttributeValue

public static @Nullable String getAttributeValue(XmlPullParser xpp, String attributeName)

Returns the value of an attribute of the current start tag.

Parameters
XmlPullParser xpp

The XmlPullParser to query.

String attributeName

The name of the attribute.

Returns
@Nullable String

The value of the attribute, or null if the current event is not a start tag or if no such attribute was found.

getAttributeValueIgnorePrefix

public static @Nullable String getAttributeValueIgnorePrefix(XmlPullParser xpp, String attributeName)

Returns the value of an attribute of the current start tag. Any raw attribute names in the current start tag have their prefixes stripped before matching.

Parameters
XmlPullParser xpp

The XmlPullParser to query.

String attributeName

The name of the attribute.

Returns
@Nullable String

The value of the attribute, or null if the current event is not a start tag or if no such attribute was found.

isEndTag

public static boolean isEndTag(XmlPullParser xpp)

Returns whether the current event is an end tag.

Parameters
XmlPullParser xpp

The XmlPullParser to query.

Returns
boolean

Whether the current event is an end tag.

Throws
org.xmlpull.v1.XmlPullParserException

If an error occurs querying the parser.

isEndTag

public static boolean isEndTag(XmlPullParser xpp, String name)

Returns whether the current event is an end tag with the specified name.

Parameters
XmlPullParser xpp

The XmlPullParser to query.

String name

The specified name.

Returns
boolean

Whether the current event is an end tag with the specified name.

Throws
org.xmlpull.v1.XmlPullParserException

If an error occurs querying the parser.

isStartTag

public static boolean isStartTag(XmlPullParser xpp)

Returns whether the current event is a start tag.

Parameters
XmlPullParser xpp

The XmlPullParser to query.

Returns
boolean

Whether the current event is a start tag.

Throws
org.xmlpull.v1.XmlPullParserException

If an error occurs querying the parser.

isStartTag

public static boolean isStartTag(XmlPullParser xpp, String name)

Returns whether the current event is a start tag with the specified name.

Parameters
XmlPullParser xpp

The XmlPullParser to query.

String name

The specified name.

Returns
boolean

Whether the current event is a start tag with the specified name.

Throws
org.xmlpull.v1.XmlPullParserException

If an error occurs querying the parser.

isStartTagIgnorePrefix

public static boolean isStartTagIgnorePrefix(XmlPullParser xpp, String name)

Returns whether the current event is a start tag with the specified name. If the current event has a raw name then its prefix is stripped before matching.

Parameters
XmlPullParser xpp

The XmlPullParser to query.

String name

The specified name.

Returns
boolean

Whether the current event is a start tag with the specified name.

Throws
org.xmlpull.v1.XmlPullParserException

If an error occurs querying the parser.