public class Whitespace
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Whitespace.Tokenizer
An iterator that splits a string on whitespace boundaries, corresponding to the XPath 3.1 function tokenize#1
|
Modifier and Type | Field and Description |
---|---|
static int |
ALL |
static int |
COLLAPSE |
static int |
IGNORABLE |
static int |
NONE
The values NONE, IGNORABLE, and ALL identify which kinds of whitespace text node
should be stripped when building a source tree.
|
static int |
PRESERVE
The values PRESERVE, REPLACE, and COLLAPSE represent the three options for whitespace
normalization.
|
static int |
REPLACE |
static int |
TRIM |
static int |
UNSPECIFIED |
static int |
XSLT |
Modifier and Type | Method and Description |
---|---|
static java.lang.CharSequence |
applyWhitespaceNormalization(int action,
java.lang.CharSequence value)
Apply schema-defined whitespace normalization to a string
|
static java.lang.CharSequence |
collapseWhitespace(java.lang.CharSequence in)
Collapse whitespace as defined in XML Schema.
|
static boolean |
containsWhitespace(java.lang.CharSequence value)
Determine if a string contains any whitespace
|
static boolean |
isWhite(char c)
Determine if a character is whitespace
|
static boolean |
isWhite(java.lang.CharSequence content)
Determine if a string is all-whitespace
|
static boolean |
isWhitespace(int ch)
Test whether a character is whitespace
|
static java.lang.CharSequence |
normalizeWhitespace(java.lang.CharSequence in)
Normalize whitespace as defined in XML Schema.
|
static java.lang.CharSequence |
removeAllWhitespace(java.lang.CharSequence value)
Remove all whitespace characters from a string
|
static java.lang.CharSequence |
removeLeadingWhitespace(java.lang.CharSequence value)
Remove leading whitespace characters from a string
|
static java.lang.String |
trim(java.lang.CharSequence s)
Trim leading and trailing whitespace from a string, returning a string.
|
static java.lang.CharSequence |
trimWhitespace(java.lang.CharSequence in)
Remove leading and trailing whitespace.
|
public static final int PRESERVE
public static final int REPLACE
public static final int COLLAPSE
public static final int TRIM
public static final int NONE
public static final int IGNORABLE
public static final int ALL
public static final int UNSPECIFIED
public static final int XSLT
public static boolean isWhitespace(int ch)
ch
- the character (Unicode codepoint) to be testedpublic static java.lang.CharSequence applyWhitespaceNormalization(int action, java.lang.CharSequence value)
action
- the action to be applied: one of PRESERVE, REPLACE, or COLLAPSEvalue
- the value to be normalizedpublic static java.lang.CharSequence removeAllWhitespace(java.lang.CharSequence value)
value
- the string from which whitespace is to be removedpublic static java.lang.CharSequence removeLeadingWhitespace(java.lang.CharSequence value)
value
- the string whose leading whitespace is to be removedpublic static boolean containsWhitespace(java.lang.CharSequence value)
value
- the string to be testedpublic static boolean isWhite(java.lang.CharSequence content)
content
- the string to be testedpublic static boolean isWhite(char c)
c
- the character to be testedpublic static java.lang.CharSequence normalizeWhitespace(java.lang.CharSequence in)
collapseWhitespace(java.lang.CharSequence)
methodin
- the string to be normalizedpublic static java.lang.CharSequence collapseWhitespace(java.lang.CharSequence in)
in
- the string whose whitespace is to be collapsedpublic static java.lang.CharSequence trimWhitespace(java.lang.CharSequence in)
in
- the input string whose whitespace is to be removedpublic static java.lang.String trim(java.lang.CharSequence s)
s
- the string to be trimmed. If null is supplied, null is returned.Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.