# XmlPullParserUtil

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/util/XmlPullParserUtil "View this page in Java")

<br />

```
@UnstableApi
class XmlPullParserUtil
```

<br />

*** ** * ** ***

[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)utility methods.

## Summary

|                                        ### Public functions                                        |
|----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | [getAttributeValue](https://developer.android.com/reference/kotlin/androidx/media3/common/util/XmlPullParserUtil#getAttributeValue(org.xmlpull.v1.XmlPullParser,java.lang.String))`(xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!, attributeName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Returns the value of an attribute of the current start tag.                         |
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | [getAttributeValueIgnorePrefix](https://developer.android.com/reference/kotlin/androidx/media3/common/util/XmlPullParserUtil#getAttributeValueIgnorePrefix(org.xmlpull.v1.XmlPullParser,java.lang.String))`(xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!, attributeName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Returns the value of an attribute of the current start tag. |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isEndTag](https://developer.android.com/reference/kotlin/androidx/media3/common/util/XmlPullParserUtil#isEndTag(org.xmlpull.v1.XmlPullParser))`(xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!)` Returns whether the current event is an end tag.                                                                                                                                                                            |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isEndTag](https://developer.android.com/reference/kotlin/androidx/media3/common/util/XmlPullParserUtil#isEndTag(org.xmlpull.v1.XmlPullParser,java.lang.String))`(xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!, name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Returns whether the current event is an end tag with the specified name.                                       |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isStartTag](https://developer.android.com/reference/kotlin/androidx/media3/common/util/XmlPullParserUtil#isStartTag(org.xmlpull.v1.XmlPullParser))`(xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!)` Returns whether the current event is a start tag.                                                                                                                                                                       |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isStartTag](https://developer.android.com/reference/kotlin/androidx/media3/common/util/XmlPullParserUtil#isStartTag(org.xmlpull.v1.XmlPullParser,java.lang.String))`(xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!, name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Returns whether the current event is a start tag with the specified name.                                  |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isStartTagIgnorePrefix](https://developer.android.com/reference/kotlin/androidx/media3/common/util/XmlPullParserUtil#isStartTagIgnorePrefix(org.xmlpull.v1.XmlPullParser,java.lang.String))`(xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!, name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Returns whether the current event is a start tag with the specified name.          |

## Public functions

### getAttributeValue

```
java-static fun getAttributeValue(xpp: XmlPullParser!, attributeName: String!): String?
```

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

|                                              Parameters                                               |
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| `xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!`  | The[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)to query. |
| `attributeName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The name of the attribute.                                                                             |

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.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

```
java-static fun getAttributeValueIgnorePrefix(xpp: XmlPullParser!, attributeName: String!): String?
```

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                                               |
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| `xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!`  | The[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)to query. |
| `attributeName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The name of the attribute.                                                                             |

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.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

```
java-static fun isEndTag(xpp: XmlPullParser!): Boolean
```

Returns whether the current event is an end tag.  

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

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the current event is an end tag. |

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

### isEndTag

```
java-static fun isEndTag(xpp: XmlPullParser!, name: String!): Boolean
```

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

|                                              Parameters                                              |
|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| `xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!` | The[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)to query. |
| `name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`         | The specified name.                                                                                    |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the current event is an end tag with the specified name. |

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

### isStartTag

```
java-static fun isStartTag(xpp: XmlPullParser!): Boolean
```

Returns whether the current event is a start tag.  

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

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the current event is a start tag. |

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

### isStartTag

```
java-static fun isStartTag(xpp: XmlPullParser!, name: String!): Boolean
```

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

|                                              Parameters                                              |
|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| `xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!` | The[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)to query. |
| `name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`         | The specified name.                                                                                    |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the current event is a start tag with the specified name. |

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

### isStartTagIgnorePrefix

```
java-static fun isStartTagIgnorePrefix(xpp: XmlPullParser!, name: String!): Boolean
```

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                                              |
|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| `xpp: `[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)`!` | The[XmlPullParser](https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html)to query. |
| `name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`         | The specified name.                                                                                    |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the current event is a start tag with the specified name. |

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