what-the-bank/sources/com/google/common/xml/XmlEscapers.java

48 lines
1.6 KiB
Java
Raw Permalink Blame History

package com.google.common.xml;
import com.airbnb.deeplinkdispatch.UrlTreeKt;
import com.google.common.escape.Escaper;
import com.google.common.escape.Escapers;
/* loaded from: classes2.dex */
public class XmlEscapers {
private static final char MAX_ASCII_CONTROL_CHAR = 31;
private static final char MIN_ASCII_CONTROL_CHAR = 0;
private static final Escaper XML_ATTRIBUTE_ESCAPER;
private static final Escaper XML_CONTENT_ESCAPER;
private static final Escaper XML_ESCAPER;
private XmlEscapers() {
}
static {
Escapers.Builder builder = Escapers.builder();
builder.setSafeRange((char) 0, (char) 65533);
builder.setUnsafeReplacement("<EFBFBD>");
for (char c = 0; c <= 31; c = (char) (c + 1)) {
if (c != '\t' && c != '\n' && c != '\r') {
builder.addEscape(c, "<EFBFBD>");
}
}
builder.addEscape('&', "&amp;");
builder.addEscape(UrlTreeKt.configurablePathSegmentPrefixChar, "&lt;");
builder.addEscape(UrlTreeKt.configurablePathSegmentSuffixChar, "&gt;");
XML_CONTENT_ESCAPER = builder.build();
builder.addEscape('\'', "&apos;");
builder.addEscape('\"', "&quot;");
XML_ESCAPER = builder.build();
builder.addEscape('\t', "&#x9;");
builder.addEscape('\n', "&#xA;");
builder.addEscape('\r', "&#xD;");
XML_ATTRIBUTE_ESCAPER = builder.build();
}
public static Escaper xmlContentEscaper() {
return XML_CONTENT_ESCAPER;
}
public static Escaper xmlAttributeEscaper() {
return XML_ATTRIBUTE_ESCAPER;
}
}