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:
- Container, Expression, InstructionInfoProvider, MappingFunction, java.io.Serializable, javax.xml.transform.SourceLocator
- 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
Methods inherited from class net.sf.saxon.expr.FunctionCall |
analyze, checkArgumentCount, getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, preEvaluate, promote, setArguments, setFunctionNameCode, simplifyArguments |
Methods inherited from class net.sf.saxon.expr.ComputedExpression |
adoptChildExpression, computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getParentExpression, getPublicId, getSpecialProperties, getSystemId, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, 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(StaticContext env)
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
- Returns:
- the simplified expression
- Throws:
XPathException
- if an error is discovered during expression
rewriting
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)
throws XPathException
- 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.
XPathException
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