package com.fyber.inneractive.sdk.util; import android.text.TextUtils; import java.util.ArrayList; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /* loaded from: classes2.dex */ public final class d1 { public static Integer a(Node node, String str) { String b = b(node, str); if (TextUtils.isEmpty(b)) { return null; } try { return Integer.valueOf(b); } catch (NumberFormatException unused) { return null; } } public static String b(Node node, String str) { Node namedItem; if (node == null || (namedItem = node.getAttributes().getNamedItem(str)) == null) { return null; } return namedItem.getNodeValue(); } public static ArrayList c(Node node, String str) { ArrayList arrayList = new ArrayList(); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); if (item.getNodeName().equals(str)) { arrayList.add(item); } } return arrayList; } public static Node d(Node node, String str) { if (node == null) { return null; } NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); if (item.getNodeName().equals(str)) { return item; } } return null; } public static String a(Node node) { if (node == null || node.getFirstChild() == null || node.getFirstChild().getNodeValue() == null) { return null; } return node.getFirstChild().getNodeValue().trim(); } }