## net.sf.saxon.functions
Class Collection

    java.lang.Object
      net.sf.saxon.expr.ComputedExpression
          net.sf.saxon.expr.FunctionCall
              net.sf.saxon.functions.SystemFunction
                  net.sf.saxon.functions.Collection

All Implemented Interfaces:
  Container, Expression, InstructionInfoProvider, MappingFunction, java.io.Serializable, javax.xml.transform.SourceLocator

public class Collection
extends SystemFunction
implements MappingFunction

Implement the fn:collection() function. The Saxon implementation loads an XML document called the collection catalogue, which acts as an index of the collection.

The structure of this index is:

     <collection>
        <doc href="doc1.xml">
        <doc href="doc2.xml">
        <doc href="doc3.xml">
     </collection>

The document URIs are resolved relative to the base URI of the doc element in the catalogue document.

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
`Collection()`

Method Summary
`void` `checkArguments(StaticContext env)` Method called during static type checking
`SequenceIterator` `iterate(XPathContext context)` Return an Iterator to iterate over the values of a sequence.
`java.lang.Object` `map(Item item, XPathContext context, java.lang.Object info)` Map from doc elements in the catalogue document to nodes returned in the result
`Expression` `preEvaluate(StaticContext env)` preEvaluate: this method suppresses compile-time evaluation by doing nothing

Methods inherited from class net.sf.saxon.functions.SystemFunction
`addContextDocumentArgument, computeCardinality, computeSpecialProperties, display, getDetails, getItemType, getRequiredType, main, makeSystemFunction, setDetails, useContextItemAsDefault`

Methods inherited from class net.sf.saxon.expr.FunctionCall
`analyze, checkArgumentCount, getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, promote, setArguments, setFunctionNameCode, simplify, simplifyArguments`

Methods inherited from class net.sf.saxon.expr.ComputedExpression

`adoptChildExpression, checkPermittedContents, computeDependencies, 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, typeError`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Collection

    public Collection()

Method Detail

### checkArguments

    public void checkArguments(StaticContext env)
                        throws XPathException

  Description copied from class: `SystemFunction`
  Method called during static type checking

  Overrides:
    `checkArguments` in class `SystemFunction`
  Throws:
    `XPathException`

### preEvaluate

    public Expression preEvaluate(StaticContext env)

  preEvaluate: this method suppresses compile-time evaluation by doing nothing

  Overrides:
    `preEvaluate` in class `FunctionCall`

### iterate

    public SequenceIterator iterate(XPathContext context)
                             throws XPathException

  Description copied from class: `ComputedExpression`
  Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.

  Specified by:
    `iterate` in interface `Expression`
  Overrides:
    `iterate` in class `ComputedExpression`
  Parameters:
    `context` - 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

  Map from doc elements in the catalogue document to nodes returned in the result

  Specified by:
    `map` in interface `MappingFunction`
  Parameters:
    `item` - A doc element in the catalogue document
    `context` - The dynamic evaluation context
    `info` - not used (set to null)
  Returns:
    the document or element referenced by the @href attribute of the doc element in the catalogue
  Throws:
    `XPathException` - if the document cannot be retrieved or parsed, unless error recovery has been chosen.