Package org.jsoup.nodes
Class Entities
java.lang.Object
org.jsoup.nodes.Entities
HTML entities, and escape routines. Source: W3C
HTML named character references.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char[]
(package private) static final int
private static Document.OutputSettings
private static final int
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
appendEncoded
(Appendable accum, Entities.EscapeMode escapeMode, int codePoint) private static boolean
canEncode
(Entities.CoreCharset charset, char c, CharsetEncoder fallback) static int
codepointsForName
(String name, int[] codepoints) (package private) static void
escape
(Appendable accum, String string, Document.OutputSettings out, boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite, boolean trimTrailing) static String
HTML escape an input string, using the default settings (UTF-8, base entities).static String
escape
(String string, Document.OutputSettings out) HTML escape an input string.static String
Get the character(s) represented by the named entitystatic boolean
isBaseNamedEntity
(String name) Check if the input is a known named entity in the base entity set.static boolean
isNamedEntity
(String name) Check if the input is a known named entityprivate static void
load
(Entities.EscapeMode e, String pointsData, int size) static String
Un-escape an HTML escaped string.(package private) static String
Unescape the input string.
-
Field Details
-
empty
private static final int empty- See Also:
-
emptyName
- See Also:
-
codepointRadix
static final int codepointRadix- See Also:
-
codeDelims
private static final char[] codeDelims -
multipoints
-
DefaultOutput
-
-
Constructor Details
-
Entities
private Entities()
-
-
Method Details
-
isNamedEntity
Check if the input is a known named entity- Parameters:
name
- the possible entity name (e.g. "lt" or "amp")- Returns:
- true if a known named entity
-
isBaseNamedEntity
Check if the input is a known named entity in the base entity set.- Parameters:
name
- the possible entity name (e.g. "lt" or "amp")- Returns:
- true if a known named entity in the base set
- See Also:
-
getByName
Get the character(s) represented by the named entity- Parameters:
name
- entity (e.g. "lt" or "amp")- Returns:
- the string value of the character(s) represented by this entity, or "" if not defined
-
codepointsForName
-
escape
HTML escape an input string. That is,<
is returned as<
- Parameters:
string
- the un-escaped string to escapeout
- the output settings to use- Returns:
- the escaped string
-
escape
HTML escape an input string, using the default settings (UTF-8, base entities). That is,<
is returned as<
- Parameters:
string
- the un-escaped string to escape- Returns:
- the escaped string
-
escape
static void escape(Appendable accum, String string, Document.OutputSettings out, boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite, boolean trimTrailing) throws IOException - Throws:
IOException
-
appendEncoded
private static void appendEncoded(Appendable accum, Entities.EscapeMode escapeMode, int codePoint) throws IOException - Throws:
IOException
-
unescape
Un-escape an HTML escaped string. That is,<
is returned as<
.- Parameters:
string
- the HTML string to un-escape- Returns:
- the unescaped string
-
unescape
Unescape the input string.- Parameters:
string
- to un-HTML-escapestrict
- if "strict" (that is, requires trailing ';' char, otherwise that's optional)- Returns:
- unescaped string
-
canEncode
-
load
-