public final class XmlUtil
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
XmlUtil.Context |
Escaping context.
|
static class |
XmlUtil.EscapingPolicy |
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.String |
escape(java.lang.String s,
XmlUtil.Context context,
XmlUtil.EscapingPolicy policy) |
Returns an escaped version of a string.
|
static boolean |
isIgnorableSpace(char c) |
Returns
true when a character is an ignorable space. |
static boolean |
isIgnorableSpace(char[] ch,
int offset,
int count) |
Returns
true when the characters in an array range are ignorable spaces. |
static boolean |
isIgnorableSpace(java.lang.String s) |
Returns
true when a string is is composed of ignorable spaces. |
static boolean |
needsEscape(java.lang.String s,
XmlUtil.Context context,
XmlUtil.EscapingPolicy policy) |
Returns
true is a string must be escaped. |
public static boolean isIgnorableSpace(char c)
true when a character is an ignorable space.
The character is ' ', '\t', '\n', '\r' or '\f'.
c - The character.true when c is an ignorable space.public static boolean isIgnorableSpace(java.lang.String s)
true when a string is is composed of ignorable spaces.s - The string.true when s is composed of ignorable spaces.public static boolean isIgnorableSpace(char[] ch,
int offset,
int count)
true when the characters in an array range are ignorable spaces.ch - The characters.offset - Index of the first character to test.count - Number of characters to test.true when the characters in [offset, offset+count[ are ignorable spaces.public static boolean needsEscape(java.lang.String s,
XmlUtil.Context context,
XmlUtil.EscapingPolicy policy)
true is a string must be escaped.
< and & must always be escaped.
> does not need escape. It is escaped if required with policy.
" needs to be escaped in attributes delimited by ". Otherwise, is escaped if required by policy.
' needs to be escaped in attributes delimited by '. Otherwise, is escaped if required by policy.
\t, \n and \r should be escaped in attributes. They are if escaped if required by policy.
s - The string.context - The context.policy - The escaping policy.true is s must be escaped incontext and using policy.public static java.lang.String escape(java.lang.String s,
XmlUtil.Context context,
XmlUtil.EscapingPolicy policy)
s - The string.context - The context.policy - The escaping policy.s incontext and using policy.Copyright © 2019. All rights reserved.