org.ucl.xpath.function
Class FnNormalizeSpace

java.lang.Object
  extended byorg.ucl.xpath.function.Function
      extended byorg.ucl.xpath.function.FnNormalizeSpace

public class FnNormalizeSpace
extends Function

Function to normalize whitespace.

Usage: fn:normalize-space($arg as xs:string?) as xs:string

This class returns the value of $arg with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20.

The whitespace characters are defined as TAB (#x9), LINE FEED (#xA), CARRIAGE RETURN (#xD) and SPACE (#x20). If the value of $arg is the empty sequence, the class returns the zero-length string.


Field Summary
 
Fields inherited from class org.ucl.xpath.function.Function
_arity, _fl, _name
 
Constructor Summary
FnNormalizeSpace()
          Constructor for FnNormalizeSpace.
 
Method Summary
 ResultSequence evaluate(java.util.Collection args)
          Evaluate the arguments.
static java.util.Collection expected_args()
          Calculate the expected arguments.
static boolean is_whitespace(char x)
          Determine whether a character is whitespace or not.
static ResultSequence normalize_space(java.util.Collection args)
          Normalize space in the arguments.
static java.lang.String normalize(java.lang.String str)
          The normalizing process.
 
Methods inherited from class org.ucl.xpath.function.Function
arity, convert_argument, convert_arguments, dynamic_context, name, set_function_library, signature, signature, signature, static_context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FnNormalizeSpace

public FnNormalizeSpace()
Constructor for FnNormalizeSpace.

Method Detail

evaluate

public ResultSequence evaluate(java.util.Collection args)
                        throws DynamicError
Evaluate the arguments.

Specified by:
evaluate in class Function
Parameters:
args - are evaluated.
Returns:
The evaluation of the space in the arguments being normalized.
Throws:
DynamicError - Dynamic error.

normalize_space

public static ResultSequence normalize_space(java.util.Collection args)
                                      throws DynamicError
Normalize space in the arguments.

Parameters:
args - are used to obtain space from, in order to be normalized.
Returns:
The result of normalizing the space in the arguments.
Throws:
DynamicError - Dynamic error.

normalize

public static java.lang.String normalize(java.lang.String str)
The normalizing process.

Parameters:
str - is the string that space will be normalized in.
Returns:
The result of the normalizing operation.

is_whitespace

public static boolean is_whitespace(char x)
Determine whether a character is whitespace or not.

Parameters:
x - is the character this operation will take place on.
Returns:
Whether or not the character is whitespace.

expected_args

public static java.util.Collection expected_args()
Calculate the expected arguments.

Returns:
The expected arguments.