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 Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic intcodepointsForName(String name, int[] codepoints) static StringHTML escape an input string, using the default settings (UTF-8, base entities).static Stringescape(String data, Document.OutputSettings out) HTML escape an input string.static StringfindPrefix(String input) Finds the longest base named entity that is a prefix of the input.static StringGet the character(s) represented by the named entitystatic booleanisBaseNamedEntity(String name) Check if the input is a known named entity in the base entity set.static booleanisNamedEntity(String name) Check if the input is a known named entitystatic StringUn-escape an HTML escaped string.
-
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
-
findPrefix
Finds the longest base named entity that is a prefix of the input. That is, input "notit" would return "not".- Returns:
- longest entity name that is a prefix of the input, or "" if no entity matches
-
escape
HTML escape an input string. That is,<is returned as<. The escaped string is suitable for use both in attributes and in text data.- Parameters:
data- the un-escaped string to escapeout- the output settings to use. This configures the character set escaped against (that is, if a character is supported in the output character set, it doesn't have to be escaped), and also HTML or XML settings.- Returns:
- the escaped string
-
escape
HTML escape an input string, using the default settings (UTF-8, base entities). That is,<is returned as<. The escaped string is suitable for use both in attributes and in text data.- Parameters:
data- the un-escaped string to escape- Returns:
- the escaped string
- See Also:
-
unescape
Un-escape an HTML escaped string. That is,<is returned as<.- Parameters:
string- the HTML string to un-escape- Returns:
- the unescaped string
-