net.sf.saxon.functions
Class Tokenize

java.lang.Object
  extended by net.sf.saxon.expr.ComputedExpression
      extended by net.sf.saxon.expr.FunctionCall
          extended by net.sf.saxon.functions.SystemFunction
              extended by net.sf.saxon.functions.Tokenize
All Implemented Interfaces:
Serializable, Expression, MappingFunction

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

Nested Class Summary
static class Tokenize.TokenIterator
          Inner class TokenIterator
 
Field Summary
 
Fields inherited from class net.sf.saxon.functions.SystemFunction
operation
 
Fields inherited from class net.sf.saxon.expr.FunctionCall
argument
 
Fields inherited from class net.sf.saxon.expr.ComputedExpression
lineNumber, NO_ARGUMENTS, staticProperties
 
Constructor Summary
Tokenize()
           
 
Method Summary
 SequenceIterator iterate(XPathContext c)
          Iterate over the results of the function
static void main(String[] args)
          Simple command-line interface for testing.
 Object map(Item item, XPathContext context, 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.functions.SystemFunction
addContextDocumentArgument, checkArguments, computeCardinality, display, getDetails, getItemType, getName, getRequiredType, makeSystemFunction, useContextItemAsDefault
 
Methods inherited from class net.sf.saxon.expr.FunctionCall
analyze, checkArgumentCount, getNumberOfArguments, getSubExpressions, preEvaluate, promote, setArguments, simplifyArguments
 
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
 

Constructor Detail

Tokenize

public Tokenize()
Method Detail

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
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 Object map(Item item,
                  XPathContext context,
                  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(String[] args)
                 throws Exception
Simple command-line interface for testing.

Parameters:
args - (1) the string to be tokenized (2) the regular expression
Throws:
Exception