# XmlPullParserUtil

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/util/XmlPullParserUtil.java+class:androidx.media3.common.util.XmlPullParserUtil)

*** ** * ** ***


```
@UnstableApi
public final class XmlPullParserUtil
```

<br />

*** ** * ** ***

`https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` utility methods.

## Summary

| ### Public methods |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil#getAttributeValue(org.xmlpull.v1.XmlPullParser,java.lang.String)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp, https://developer.android.com/reference/java/lang/String.html attributeName)` Returns the value of an attribute of the current start tag. |
| `static @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil#getAttributeValueIgnorePrefix(org.xmlpull.v1.XmlPullParser,java.lang.String)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp, https://developer.android.com/reference/java/lang/String.html attributeName)` Returns the value of an attribute of the current start tag. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil#isEndTag(org.xmlpull.v1.XmlPullParser)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp)` Returns whether the current event is an end tag. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil#isEndTag(org.xmlpull.v1.XmlPullParser,java.lang.String)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp, https://developer.android.com/reference/java/lang/String.html name)` Returns whether the current event is an end tag with the specified name. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil#isStartTag(org.xmlpull.v1.XmlPullParser)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp)` Returns whether the current event is a start tag. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil#isStartTag(org.xmlpull.v1.XmlPullParser,java.lang.String)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp, https://developer.android.com/reference/java/lang/String.html name)` Returns whether the current event is a start tag with the specified name. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil#isStartTagIgnorePrefix(org.xmlpull.v1.XmlPullParser,java.lang.String)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp, https://developer.android.com/reference/java/lang/String.html name)` 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 |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp` | The `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` to query. |
| `https://developer.android.com/reference/java/lang/String.html attributeName` | The name of the attribute. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | 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 |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp` | The `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` to query. |
| `https://developer.android.com/reference/java/lang/String.html attributeName` | The name of the attribute. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | 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 |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp` | The `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` to query. |

| Returns |
|---|---|
| `boolean` | Whether the current event is an end tag. |

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` | 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 |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp` | The `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` to query. |
| `https://developer.android.com/reference/java/lang/String.html name` | The specified name. |

| Returns |
|---|---|
| `boolean` | Whether the current event is an end tag with the specified name. |

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` | If an error occurs querying the parser. |

### isStartTag

```
public static boolean isStartTag(XmlPullParser xpp)
```

Returns whether the current event is a start tag.

| Parameters |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp` | The `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` to query. |

| Returns |
|---|---|
| `boolean` | Whether the current event is a start tag. |

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` | 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 |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp` | The `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` to query. |
| `https://developer.android.com/reference/java/lang/String.html name` | The specified name. |

| Returns |
|---|---|
| `boolean` | Whether the current event is a start tag with the specified name. |

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` | 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 |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html xpp` | The `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html` to query. |
| `https://developer.android.com/reference/java/lang/String.html name` | The specified name. |

| Returns |
|---|---|
| `boolean` | Whether the current event is a start tag with the specified name. |

| Throws |
|---|---|
| `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParserException.html` | If an error occurs querying the parser. |