44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
package com.ubtech.utils;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.StringReader;
|
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
import javax.xml.parsers.ParserConfigurationException;
|
|
import org.w3c.dom.Document;
|
|
import org.xml.sax.InputSource;
|
|
import org.xml.sax.SAXException;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class XmlHelper {
|
|
public static Document a(String str) throws Exception {
|
|
try {
|
|
return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(str)));
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
throw e;
|
|
} catch (ParserConfigurationException e2) {
|
|
e2.printStackTrace();
|
|
throw e2;
|
|
} catch (SAXException e3) {
|
|
e3.printStackTrace();
|
|
throw e3;
|
|
}
|
|
}
|
|
|
|
public static Document a(File file) throws Exception {
|
|
try {
|
|
return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file);
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
throw e;
|
|
} catch (ParserConfigurationException e2) {
|
|
e2.printStackTrace();
|
|
throw e2;
|
|
} catch (SAXException e3) {
|
|
e3.printStackTrace();
|
|
throw e3;
|
|
}
|
|
}
|
|
}
|