mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-26 09:02:34 -06:00
49 lines
1.6 KiB
Java
49 lines
1.6 KiB
Java
package com.google.common.xml;
|
||
|
||
import com.google.common.escape.Escaper;
|
||
import com.google.common.escape.Escapers;
|
||
import kotlin.text.Typography;
|
||
import okio.Utf8;
|
||
|
||
@ElementTypesAreNonnullByDefault
|
||
/* loaded from: classes3.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;
|
||
|
||
public static Escaper xmlAttributeEscaper() {
|
||
return XML_ATTRIBUTE_ESCAPER;
|
||
}
|
||
|
||
public static Escaper xmlContentEscaper() {
|
||
return XML_CONTENT_ESCAPER;
|
||
}
|
||
|
||
private XmlEscapers() {
|
||
}
|
||
|
||
static {
|
||
Escapers.Builder builder = Escapers.builder();
|
||
builder.setSafeRange((char) 0, Utf8.REPLACEMENT_CHARACTER);
|
||
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(Typography.amp, "&");
|
||
builder.addEscape(Typography.less, "<");
|
||
builder.addEscape(Typography.greater, ">");
|
||
XML_CONTENT_ESCAPER = builder.build();
|
||
builder.addEscape('\'', "'");
|
||
builder.addEscape(Typography.quote, """);
|
||
XML_ESCAPER = builder.build();
|
||
builder.addEscape('\t', "	");
|
||
builder.addEscape('\n', "
");
|
||
builder.addEscape('\r', "
");
|
||
XML_ATTRIBUTE_ESCAPER = builder.build();
|
||
}
|
||
}
|