Rabbit-R1/android (non root)/java/sources/com/google/android/exoplayer2/util/XmlPullParserUtil.java
2024-05-21 17:08:36 -04:00

55 lines
2.1 KiB
Java

package com.google.android.exoplayer2.util;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/* loaded from: classes2.dex */
public final class XmlPullParserUtil {
private XmlPullParserUtil() {
}
public static boolean isEndTag(XmlPullParser xmlPullParser, String str) throws XmlPullParserException {
return isEndTag(xmlPullParser) && xmlPullParser.getName().equals(str);
}
public static boolean isEndTag(XmlPullParser xmlPullParser) throws XmlPullParserException {
return xmlPullParser.getEventType() == 3;
}
public static boolean isStartTag(XmlPullParser xmlPullParser, String str) throws XmlPullParserException {
return isStartTag(xmlPullParser) && xmlPullParser.getName().equals(str);
}
public static boolean isStartTag(XmlPullParser xmlPullParser) throws XmlPullParserException {
return xmlPullParser.getEventType() == 2;
}
public static boolean isStartTagIgnorePrefix(XmlPullParser xmlPullParser, String str) throws XmlPullParserException {
return isStartTag(xmlPullParser) && stripPrefix(xmlPullParser.getName()).equals(str);
}
public static String getAttributeValue(XmlPullParser xmlPullParser, String str) {
int attributeCount = xmlPullParser.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
if (xmlPullParser.getAttributeName(i).equals(str)) {
return xmlPullParser.getAttributeValue(i);
}
}
return null;
}
public static String getAttributeValueIgnorePrefix(XmlPullParser xmlPullParser, String str) {
int attributeCount = xmlPullParser.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
if (stripPrefix(xmlPullParser.getAttributeName(i)).equals(str)) {
return xmlPullParser.getAttributeValue(i);
}
}
return null;
}
private static String stripPrefix(String str) {
int indexOf = str.indexOf(58);
return indexOf == -1 ? str : str.substring(indexOf + 1);
}
}