com.saxonica.functions.extfn
Class Parse.ParseCall

java.lang.Object
  extended by net.sf.saxon.lib.ExtensionFunctionCall
      extended by com.saxonica.functions.extfn.Parse.ParseCall
All Implemented Interfaces:
Serializable
Enclosing class:
Parse

protected static class Parse.ParseCall
extends ExtensionFunctionCall

See Also:
Serialized Form

Constructor Summary
protected Parse.ParseCall()
           
 
Method Summary
 SequenceIterator call(SequenceIterator[] arguments, XPathContext context)
          Evaluate this function call at run-time
 void copyLocalData(ExtensionFunctionCall destination)
          Copy local data from one copy of the function to another.
protected  void setXMLReader(Configuration config, ParseOptions source)
          Set the XML parser to be used, if different from the default XML parser
 void supplyStaticContext(StaticContext context, int locationId, Expression[] arguments)
          Supply static context information.
 
Methods inherited from class net.sf.saxon.lib.ExtensionFunctionCall
effectiveBooleanValue, getContainer, getDefinition, getExecutable, rewrite, setDefinition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parse.ParseCall

protected Parse.ParseCall()
Method Detail

supplyStaticContext

public void supplyStaticContext(StaticContext context,
                                int locationId,
                                Expression[] arguments)
                         throws XPathException
Supply static context information.

This method is called during compilation to provide information about the static context in which the function call appears. If the implementation of the function needs information from the static context, then it should save it now, as it will not be available later at run-time.

The implementation also has the opportunity to examine the expressions that appear in the arguments to the function call at this stage. These might already have been modified from the original expressions as written by the user. The implementation should not modify any of these expressions.

The default implementation of this method does nothing.

Overrides:
supplyStaticContext in class ExtensionFunctionCall
Parameters:
context - The static context in which the function call appears. The method must not modify the static context.
locationId -
arguments - The XPath expressions supplied in the call to this function. The method must not modify this array, or any of the expressions contained in the array. @throws net.sf.saxon.trans.XPathException if the implementation is able to detect a static error in the way the function is being called (for example it might require that the types of the arguments are consistent with each other).
Throws:
XPathException - if the implementation is able to detect a static error in the way the function is being called (for example it might require that the types of the arguments are consistent with each other).

copyLocalData

public void copyLocalData(ExtensionFunctionCall destination)
Copy local data from one copy of the function to another. This method must be implemented in any subclass that maintains local data retained from the static context; the job of the method is to copy this local data to the supplied destination function.

Overrides:
copyLocalData in class ExtensionFunctionCall
Parameters:
destination - the function to which the local data must be copied. This will always be an instance of the same function class as the source function.

call

public SequenceIterator call(SequenceIterator[] arguments,
                             XPathContext context)
                      throws XPathException
Evaluate this function call at run-time

Specified by:
call in class ExtensionFunctionCall
Parameters:
arguments - The values of the arguments to the function call. Each argument value (which is in general a sequence) is supplied in the form of an iterator over the items in the sequence. If required, the supplied sequence can be materialized by calling, for example, new SequenceExtent(arguments[i]). If the argument is always a singleton, then the single item may be obtained by calling arguments[i].next(). The implementation is not obliged to read all the items in each SequenceIterator if they are not required to compute the result; but if any SequenceIterator is not read to completion, it is good practice to call its close() method.
context - The XPath dynamic evaluation context
Returns:
an iterator over the results of the function. If the result is a single item, it can be returned in the form of a SingletonIterator. If the result is an empty sequence, the method should return EmptyIterator.getInstance()
Throws:
XPathException - if a dynamic error occurs during evaluation of the function. The Saxon run-time code will add information about the error location.

setXMLReader

protected void setXMLReader(Configuration config,
                            ParseOptions source)
                     throws XPathException
Set the XML parser to be used, if different from the default XML parser

Parameters:
config - the Saxon configuration
source - the ParseOptions object to be updated with the selected parser
Throws:
XPathException - if the selected parser cannot be loaded


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.