正在查看: Top浏览器 v4.6.16 应用的 d.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Top浏览器 v4.6.16 应用的 d.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package m.k.e;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import m.k.e.b;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
public abstract class d<D extends m.k.e.b> implements ErrorHandler, EntityResolver {
public Schema schema;
public Source[] schemaSources;
private static Logger log = Logger.getLogger(d.class.getName());
public static final URL XML_SCHEMA_RESOURCE = Thread.currentThread().getContextClassLoader().getResource("org/seamless/schemas/xml.xsd");
public class a extends HashMap<URI, URL> {
public a() {
put(m.k.e.b.XML_SCHEMA_NAMESPACE, d.XML_SCHEMA_RESOURCE);
}
}
public class b extends c {
public b(short s) {
super(s);
}
@Override
public void c(Node node) {
CDATASection cDATASection = (CDATASection) node;
cDATASection.getParentNode().setTextContent(cDATASection.getData());
}
}
public static abstract class c {
public short a;
public c(short s) {
this.a = s;
}
public boolean b() {
return false;
}
public abstract void c(Node node);
}
public d() {
this(null);
}
public static void accept(Node node, c cVar) {
if (node == null || cVar.b()) {
return;
}
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node item = childNodes.item(i);
if (item.getNodeType() == cVar.a) {
cVar.c(item);
if (cVar.b()) {
return;
}
}
accept(item, cVar);
}
}
public static String escape(String str) {
return escape(str, false, false);
}
public static String stripElements(String str) {
if (str == null) {
return null;
}
return str.replaceAll("<([a-zA-Z]|/).*?>", "");
}
public static String wrap(String str, String str2) {
return wrap(str, null, str2);
}
public abstract D createDOM(Document document);
public D createDocument() {
try {
return createDOM(createFactory(false).newDocumentBuilder().newDocument());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public DocumentBuilderFactory createFactory(boolean z) {
DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance();
try {
newInstance.setNamespaceAware(true);
if (z) {
newInstance.setXIncludeAware(true);
newInstance.setFeature("http://apache.org/xml/features/xinclude/fixup-base-uris", false);
newInstance.setFeature("http://apache.org/xml/features/xinclude/fixup-language", false);
newInstance.setSchema(getSchema());
newInstance.setFeature("http://apache.org/xml/features/validation/dynamic", true);
}
return newInstance;
} catch (ParserConfigurationException e) {
throw new f(e);
}
}
public Transformer createTransformer(String str, int i, boolean z) {
try {
TransformerFactory newInstance = TransformerFactory.newInstance();
if (i > 0) {
try {
newInstance.setAttribute("indent-number", Integer.valueOf(i));
} catch (IllegalArgumentException unused) {
}
}
Transformer newTransformer = newInstance.newTransformer();
newTransformer.setOutputProperty("omit-xml-declaration", z ? "no" : "yes");
if (z) {
try {
newTransformer.setOutputProperty("http://www.oracle.com/xml/is-standalone", "yes");
} catch (IllegalArgumentException unused2) {
}
}
newTransformer.setOutputProperty("indent", i > 0 ? "yes" : "no");
if (i > 0) {
newTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", Integer.toString(i));
}
newTransformer.setOutputProperty("method", str);
return newTransformer;
} catch (Exception e) {
throw new f(e);
}
}
public XPath createXPath(NamespaceContext namespaceContext) {
XPath newXPath = createXPathFactory().newXPath();
newXPath.setNamespaceContext(namespaceContext);
return newXPath;
}
public XPathFactory createXPathFactory() {
return XPathFactory.newInstance();
}
@Override
public void error(SAXParseException sAXParseException) {
throw new SAXException(new f(sAXParseException));
}
@Override
public void fatalError(SAXParseException sAXParseException) {
throw new SAXException(new f(sAXParseException));
}
public Schema getSchema() {
if (this.schema == null) {
try {
SchemaFactory newInstance = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
newInstance.setResourceResolver(new m.k.e.a(new a()));
Source[] sourceArr = this.schemaSources;
if (sourceArr != null) {
this.schema = newInstance.newSchema(sourceArr);
} else {
this.schema = newInstance.newSchema();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return this.schema;
}
public Object getXPathResult(m.k.e.b bVar, XPath xPath, String str, QName qName) {
return getXPathResult(bVar.getW3CDocument(), xPath, str, qName);
}
public boolean isIgnorableWSNode(Node node) {
return node.getNodeType() == 3 && node.getTextContent().matches("[\\t\\n\\x0B\\f\\r\\s]+");
}
public D parse(URL url) {
return parse(url, true);
}
public String print(m.k.e.b bVar) {
return print(bVar, 4, true);
}
public String printHTML(Document document) {
return printHTML(document, 4, true, true);
}
public void removeIgnorableWSNodes(Element element) {
Node firstChild = element.getFirstChild();
while (firstChild != null) {
Node nextSibling = firstChild.getNextSibling();
if (isIgnorableWSNode(firstChild)) {
element.removeChild(firstChild);
} else if (firstChild.getNodeType() == 1) {
removeIgnorableWSNodes((Element) firstChild);
}
firstChild = nextSibling;
}
}
@Override
public InputSource resolveEntity(String str, String str2) {
InputSource inputSource = str2.startsWith("file://") ? new InputSource(new FileInputStream(new File(URI.create(str2)))) : new InputSource(new ByteArrayInputStream(new byte[0]));
inputSource.setPublicId(str);
inputSource.setSystemId(str2);
return inputSource;
}
public f unwrapException(Exception exc) {
return (exc.getCause() == null || !(exc.getCause() instanceof f)) ? new f(exc) : (f) exc.getCause();
}
public void validate(URL url) {
if (url == null) {
throw new IllegalArgumentException("Can't validate null URL");
}
log.fine("Validating XML of URL: " + url);
validate(new StreamSource(url.toString()));
}
@Override
public void warning(SAXParseException sAXParseException) {
log.warning(sAXParseException.toString());
}
public d(Source[] sourceArr) {
this.schemaSources = sourceArr;
}
public static String escape(String str, boolean z, boolean z2) {
if (str == null) {
return null;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char charAt = str.charAt(i);
String str2 = charAt != '\"' ? charAt != '&' ? charAt != '<' ? charAt != '>' ? null : ">" : "<" : "&" : """;
if (str2 != null) {
sb.append(str2);
} else {
sb.append(charAt);
}
}
String sb2 = sb.toString();
if (z2) {
Matcher matcher = Pattern.compile("(\\n+)(\\s*)(.*)").matcher(sb2);
StringBuffer stringBuffer = new StringBuffer();
while (matcher.find()) {
String group = matcher.group(2);
StringBuilder sb3 = new StringBuilder();
for (int i2 = 0; i2 < group.length(); i2++) {
sb3.append(" ");
}
matcher.appendReplacement(stringBuffer, "$1" + sb3.toString() + "$3");
}
matcher.appendTail(stringBuffer);
sb2 = stringBuffer.toString();
}
return z ? sb2.replaceAll("\n", "<br/>") : sb2;
}
public static String wrap(String str, String str2, String str3) {
StringBuilder sb = new StringBuilder();
sb.append("<");
sb.append(str);
if (str2 != null) {
sb.append(" xmlns=\"");
sb.append(str2);
sb.append("\"");
}
sb.append(">");
sb.append(str3);
sb.append("</");
sb.append(str);
sb.append(">");
return sb.toString();
}
public Object getXPathResult(m.k.e.c cVar, XPath xPath, String str, QName qName) {
return getXPathResult(cVar.getW3CElement(), xPath, str, qName);
}
public D parse(String str) {
return parse(str, true);
}
public String print(m.k.e.b bVar, int i) {
return print(bVar, i, true);
}
public String printHTML(Document document, int i, boolean z, boolean z2) {
Document document2 = (Document) document.cloneNode(true);
accept(document2.getDocumentElement(), new b((short) 4));
removeIgnorableWSNodes(document2.getDocumentElement());
try {
Transformer createTransformer = createTransformer("html", i, z);
if (z2) {
createTransformer.setOutputProperty("doctype-public", "-//W3C//DTD HTML 4.01 Transitional//EN");
createTransformer.setOutputProperty("doctype-system", "http://www.w3.org/TR/html4/loose.dtd");
}
StringWriter stringWriter = new StringWriter();
createTransformer.transform(new DOMSource(document2), new StreamResult(stringWriter));
stringWriter.flush();
return stringWriter.toString().replaceFirst("\\s*<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">", "").replaceFirst("<html xmlns=\"http://www.w3.org/1999/xhtml\">", "<html>");
} catch (Exception e) {
throw new f(e);
}
}
public XPath createXPath(XPathFactory xPathFactory, NamespaceContext namespaceContext) {
XPath newXPath = xPathFactory.newXPath();
newXPath.setNamespaceContext(namespaceContext);
return newXPath;
}
public Object getXPathResult(Node node, XPath xPath, String str, QName qName) {
try {
log.fine("Evaluating xpath query: " + str);
return xPath.evaluate(str, node, qName);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public D parse(File file) {
return parse(file, true);
}
public String print(m.k.e.b bVar, boolean z) {
return print(bVar, 4, z);
}
public D parse(InputStream inputStream) {
return parse(inputStream, true);
}
public String print(m.k.e.b bVar, int i, boolean z) {
return print(bVar.getW3CDocument(), i, z);
}
public void validate(String str) {
if (str != null) {
log.fine("Validating XML string characters: " + str.length());
validate(new SAXSource(new InputSource(new StringReader(str))));
return;
}
throw new IllegalArgumentException("Can't validate null string");
}
public D parse(URL url, boolean z) {
if (url != null) {
try {
return parse(url.openStream(), z);
} catch (Exception e) {
throw new f("Parsing URL failed: " + url, e);
}
}
throw new IllegalArgumentException("Can't parse null URL");
}
public String print(Document document, int i, boolean z) {
removeIgnorableWSNodes(document.getDocumentElement());
return print(new DOMSource(document.getDocumentElement()), i, z);
}
public String print(String str, int i, boolean z) {
return print(new StreamSource(new StringReader(str)), i, z);
}
public void validate(Document document) {
validate(new DOMSource(document));
}
public D parse(String str, boolean z) {
if (str != null) {
return parse(new InputSource(new StringReader(str)), z);
}
throw new IllegalArgumentException("Can't parse null string");
}
public String print(Source source, int i, boolean z) {
try {
Transformer createTransformer = createTransformer("xml", i, z);
createTransformer.setOutputProperty("encoding", "utf-8");
StringWriter stringWriter = new StringWriter();
createTransformer.transform(source, new StreamResult(stringWriter));
stringWriter.flush();
return stringWriter.toString();
} catch (Exception e) {
throw new f(e);
}
}
public void validate(m.k.e.b bVar) {
validate(new DOMSource(bVar.getW3CDocument()));
}
public void validate(Source source) {
try {
Validator newValidator = getSchema().newValidator();
newValidator.setErrorHandler(this);
newValidator.validate(source);
} catch (Exception e) {
throw unwrapException(e);
}
}
public D parse(File file, boolean z) {
if (file != null) {
try {
return parse(file.toURI().toURL(), z);
} catch (Exception e) {
throw new f("Parsing file failed: " + file, e);
}
}
throw new IllegalArgumentException("Can't parse null file");
}
public D parse(InputStream inputStream, boolean z) {
return parse(new InputSource(inputStream), z);
}
public D parse(InputSource inputSource, boolean z) {
try {
DocumentBuilder newDocumentBuilder = createFactory(z).newDocumentBuilder();
newDocumentBuilder.setEntityResolver(this);
newDocumentBuilder.setErrorHandler(this);
Document parse = newDocumentBuilder.parse(inputSource);
parse.normalizeDocument();
return createDOM(parse);
} catch (Exception e) {
throw unwrapException(e);
}
}
}