net.sf.saxon.functions
Class Tokenize
java.lang.Object
net.sf.saxon.expr.ComputedExpression
net.sf.saxon.expr.FunctionCall
net.sf.saxon.functions.SystemFunction
net.sf.saxon.functions.Tokenize
- All Implemented Interfaces:
- Expression, MappingFunction, java.io.Serializable
- public class Tokenize
- extends SystemFunction
- implements MappingFunction
This class implements the tokenize() function for regular expression matching. This returns a
sequence of strings representing the unmatched substrings: the separators which match the
regular expression are not returned.
- See Also:
- Serialized Form
Method Summary |
SequenceIterator |
iterate(XPathContext c)
Iterate over the results of the function |
static void |
main(java.lang.String[] args)
Simple command-line interface for testing. |
java.lang.Object |
map(Item item,
XPathContext context,
java.lang.Object info)
Mapping function to map a sequence of Unicode codepoints to a sequence
of strings |
Expression |
simplify()
Simplify and validate. |
Methods inherited from class net.sf.saxon.expr.ComputedExpression |
computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getDependencies, getIntrinsicDependencies, getLineNumber, getSpecialProperties, markTailFunctionCalls, setLineNumber, typeError |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Tokenize
public Tokenize()
simplify
public Expression simplify()
throws XPathException
- Simplify and validate.
This is a pure function so it can be simplified in advance if the arguments are known
- Specified by:
simplify
in interface Expression
- Overrides:
simplify
in class FunctionCall
- Throws:
XPathException
iterate
public SequenceIterator iterate(XPathContext c)
throws XPathException
- Iterate over the results of the function
- Specified by:
iterate
in interface Expression
- Overrides:
iterate
in class ComputedExpression
- Parameters:
c
- supplies the context for evaluation
- Returns:
- a SequenceIterator that can be used to iterate over the result
of the expression
- Throws:
XPathException
- if any dynamic error occurs evaluating the
expression
map
public java.lang.Object map(Item item,
XPathContext context,
java.lang.Object info)
- Mapping function to map a sequence of Unicode codepoints to a sequence
of strings
- Specified by:
map
in interface MappingFunction
- Parameters:
item
- The item to be mapped.
If context is supplied, this must be the same as context.currentItem().context
- The processing context. This is supplied only for mapping constructs that
set the context node, position, and size. Otherwise it is null.info
- Arbitrary information supplied by the creator of the MappingIterator. It must be
read-only and immutable for the duration of the iteration.
- Returns:
- either (a) a SequenceIterator over the sequence of items that the supplied input
item maps to, or (b) an Item if it maps to a single item, or (c) null if it maps to an empty
sequence.
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Simple command-line interface for testing.
- Parameters:
args
- (1) the string to be tokenized (2) the regular expression
- Throws:
java.lang.Exception