- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
73 lines
2.4 KiB
Java
73 lines
2.4 KiB
Java
package com.amazonaws.util;
|
|
|
|
import com.amazonaws.logging.Log;
|
|
import com.amazonaws.logging.LogFactory;
|
|
import csdk.gluads.Consts;
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.InputStream;
|
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
import javax.xml.parsers.ParserConfigurationException;
|
|
import javax.xml.xpath.XPath;
|
|
import javax.xml.xpath.XPathConstants;
|
|
import javax.xml.xpath.XPathFactory;
|
|
import org.w3c.dom.Document;
|
|
import org.w3c.dom.Node;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class XpathUtils {
|
|
public static Log log = LogFactory.getLog(XpathUtils.class);
|
|
public static DocumentBuilderFactory factory = getDocumentBuilderFactory();
|
|
|
|
public static boolean isEmpty(Node node) {
|
|
return node == null;
|
|
}
|
|
|
|
public static DocumentBuilderFactory getDocumentBuilderFactory() {
|
|
try {
|
|
DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
|
|
newInstance.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
|
newInstance.setXIncludeAware(false);
|
|
newInstance.setExpandEntityReferences(false);
|
|
return newInstance;
|
|
} catch (ParserConfigurationException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static Document documentFrom(InputStream inputStream) {
|
|
NamespaceRemovingInputStream namespaceRemovingInputStream = new NamespaceRemovingInputStream(inputStream);
|
|
Document parse = factory.newDocumentBuilder().parse(namespaceRemovingInputStream);
|
|
namespaceRemovingInputStream.close();
|
|
return parse;
|
|
}
|
|
|
|
public static Document documentFrom(String str) {
|
|
return documentFrom(new ByteArrayInputStream(str.getBytes(StringUtils.UTF8)));
|
|
}
|
|
|
|
public static String asString(String str, Node node) {
|
|
return evaluateAsString(str, node);
|
|
}
|
|
|
|
public static String evaluateAsString(String str, Node node) {
|
|
if (isEmpty(node)) {
|
|
return null;
|
|
}
|
|
if (Consts.STRING_PERIOD.equals(str) || asNode(str, node) != null) {
|
|
return xpath().evaluate(str, node).trim();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static Node asNode(String str, Node node) {
|
|
if (node == null) {
|
|
return null;
|
|
}
|
|
return (Node) xpath().evaluate(str, node, XPathConstants.NODE);
|
|
}
|
|
|
|
public static XPath xpath() {
|
|
return XPathFactory.newInstance().newXPath();
|
|
}
|
|
}
|