Package org.jaxen.function
Class NormalizeSpaceFunction
- java.lang.Object
-
- org.jaxen.function.NormalizeSpaceFunction
-
- All Implemented Interfaces:
Function
public class NormalizeSpaceFunction extends java.lang.Object implements Function
4.2
string normalize-space(string)The normalize-space function returns the argument string with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space. Whitespace characters are the same as those allowed by the S production in XML. If the argument is omitted, it defaults to the context node converted to a string, in other words the string-value of the context node.
- Author:
- James Strachan (james@metastuff.com)
- See Also:
- Section 4.2 of the XPath Specification
-
-
Constructor Summary
Constructors Constructor Description NormalizeSpaceFunction()Create a newNormalizeSpaceFunctionobject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectcall(Context context, java.util.List args)Returns the string-value of the first item inargsafter removing all leading and trailing white space, and replacing each other sequence of whitespace by a single space.static java.lang.Stringevaluate(java.lang.Object strArg, Navigator nav)Returns the string-value ofstrArgafter removing all leading and trailing white space, and replacing each other sequence of whitespace by a single space.
-
-
-
Method Detail
-
call
public java.lang.Object call(Context context, java.util.List args) throws FunctionCallException
Returns the string-value of the first item inargsafter removing all leading and trailing white space, and replacing each other sequence of whitespace by a single space. Whitespace consists of the characters space (0x32), carriage return (0x0D), linefeed (0x0A), and tab (0x09).- Specified by:
callin interfaceFunction- Parameters:
context- the context at the point in the expression when the function is calledargs- a list that contains exactly one item- Returns:
- a normalized
String - Throws:
FunctionCallException- ifargsdoes not have length one
-
evaluate
public static java.lang.String evaluate(java.lang.Object strArg, Navigator nav)Returns the string-value ofstrArgafter removing all leading and trailing white space, and replacing each other sequence of whitespace by a single space. Whitespace consists of the characters space (0x32), carriage return (0x0D), linefeed (0x0A), and tab (0x09).- Parameters:
strArg- the object whose string-value is normalizednav- the context at the point in the expression when the function is called- Returns:
- the normalized string-value
-
-