com.saxonica.extra
Class Try

java.lang.Object
  extended bynet.sf.saxon.expr.ComputedExpression
      extended bynet.sf.saxon.expr.FunctionCall
          extended bynet.sf.saxon.functions.SystemFunction
              extended bycom.saxonica.extra.Try
All Implemented Interfaces:
Container, Expression, InstructionInfoProvider, java.io.Serializable, javax.xml.transform.SourceLocator

public class Try
extends SystemFunction

This class implements the saxon:try() extension function, which is specially recognized by the system because it uses a non-standard approach to evaluating its arguments

See Also:
Serialized Form

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
locationId, staticProperties
 
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
 
Constructor Summary
Try()
           
 
Method Summary
 int computeCardinality()
          Determine the cardinality of the function.
 Item evaluateItem(XPathContext c)
          Evaluate in a general context
 ItemType getItemType(TypeHierarchy th)
          Determine the item type of the value returned by the function
 SequenceIterator iterate(XPathContext c)
          Iterate over the results of the function
 Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)
          Type-check the expression.
 Expression simplify(StaticContext env)
          Simplify the function call.
 Expression typeCheck(StaticContext env, ItemType contextItemType)
          Type-check the expression.
 
Methods inherited from class net.sf.saxon.functions.SystemFunction
addContextDocumentArgument, checkArguments, computeSpecialProperties, display, getDetails, getErrorCodeForTypeErrors, getRequiredType, main, makeSystemFunction, setDetails, useContextItemAsDefault
 
Methods inherited from class net.sf.saxon.expr.FunctionCall
checkArgumentCount, getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, preEvaluate, promote, setArguments, setFunctionNameCode, simplifyArguments
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, dynamicError, effectiveBooleanValue, evaluateAsString, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, suppressValidation, typeError, typeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Try

public Try()
Method Detail

simplify

public Expression simplify(StaticContext env)
                    throws XPathException
Simplify the function call. Returns the value of the first argument if this is known statically.

Specified by:
simplify in interface Expression
Overrides:
simplify in class FunctionCall
Throws:
XPathException

typeCheck

public Expression typeCheck(StaticContext env,
                            ItemType contextItemType)
                     throws XPathException
Type-check the expression. This also calls preEvaluate() to evaluate the function if all the arguments are constant; functions that do not require this behavior can override the preEvaluate method.

Specified by:
typeCheck in interface Expression
Overrides:
typeCheck in class FunctionCall
Throws:
XPathException

optimize

public Expression optimize(Optimizer opt,
                           StaticContext env,
                           ItemType contextItemType)
                    throws XPathException
Type-check the expression. This also calls preEvaluate() to evaluate the function if all the arguments are constant; functions that do not require this behavior can override the preEvaluate method.

Specified by:
optimize in interface Expression
Overrides:
optimize in class FunctionCall
Parameters:
opt - the optimizer in use. This provides access to supporting functions; it also allows different optimization strategies to be used in different circumstances.
env - the static context of the expression
contextItemType - the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to Type.ITEM_TYPE
Returns:
the original expression, rewritten if appropriate to optimize execution
Throws:
XPathException

computeCardinality

public int computeCardinality()
Determine the cardinality of the function.

Overrides:
computeCardinality in class SystemFunction

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the item type of the value returned by the function

Specified by:
getItemType in interface Expression
Overrides:
getItemType in class SystemFunction
Parameters:
th -

evaluateItem

public Item evaluateItem(XPathContext c)
                  throws XPathException
Evaluate in a general context

Specified by:
evaluateItem in interface Expression
Overrides:
evaluateItem in class ComputedExpression
Parameters:
c - The context in which the expression is to be evaluated
Returns:
the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
Throws:
XPathException - if any dynamic error occurs evaluating the expression

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