## net.sf.saxon.instruct
Class Copy

    java.lang.Object
      |
      +--net.sf.saxon.expr.ComputedExpression
            |
            +--net.sf.saxon.instruct.Instruction
                  |
                  +--net.sf.saxon.instruct.InstructionWithChildren
                        |
                        +--net.sf.saxon.instruct.ElementCreator
                              |
                              +--net.sf.saxon.instruct.Copy

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

public class Copy
extends ElementCreator

Handler for xsl:copy elements in stylesheet.

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.instruct.ElementCreator
`inheritNamespaces, schemaType, useAttributeSets, validation`

Fields inherited from class net.sf.saxon.instruct.InstructionWithChildren
`children`

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
`Copy(AttributeSet[] useAttributeSets, boolean copyNamespaces, boolean inheritNamespaces, SchemaType schemaType, int validation)`

Method Summary
`Expression` `analyze(StaticContext env, ItemType contextItemType)` Perform static analysis of an expression and its subexpressions.
`void` `display(int level, NamePool pool, java.io.PrintStream out)` Diagnostic print of expression structure.
`int` `getInstructionNameCode()` Get the name of this instruction for diagnostic and tracing purposes
`ItemType` `getItemType()` Get the item type of the result of this instruction.
`protected int` `getNameCode(XPathContext context)` Callback from ElementCreator when constructing an element
`protected void` `outputNamespaceNodes(XPathContext context, Receiver receiver)` Callback to output namespace nodes for the new element.
`TailCall` `processLeavingTail(XPathContext context)` Evaluate the instruction to produce a new element node

Methods inherited from class net.sf.saxon.instruct.ElementCreator
`evaluateItem, getCardinality, getValidationMode, setValidationMode`

Methods inherited from class net.sf.saxon.instruct.InstructionWithChildren
`displayChildren, getChildren, iterateSubExpressions, processChildren, processChildrenLeavingTail, promoteInst, setChildren, simplify`

Methods inherited from class net.sf.saxon.instruct.Instruction
`appendItem, assembleParams, assembleTunnelParams, computeCardinality, computeSpecialProperties, dynamicError, dynamicError, effectiveBooleanValue, evaluateAsString, getImplementationMethod, getInstructionInfo, getSourceLocator, iterate, process, promote`

Methods inherited from class net.sf.saxon.expr.ComputedExpression
`adoptChildExpression, computeDependencies, computeStaticProperties, dynamicError, dynamicError, getColumnNumber, getConstructType, getDependencies, getExecutable, getIntrinsicDependencies, getLineNumber, getLocationId, getParentExpression, getPublicId, getSpecialProperties, getSystemId, markTailFunctionCalls, resetStaticProperties, setLocationId, setParentExpression, typeError`

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

Methods inherited from interface javax.xml.transform.SourceLocator
`getColumnNumber, getLineNumber, getPublicId, getSystemId`

Constructor Detail

### Copy

    public Copy(AttributeSet[] useAttributeSets,
                boolean copyNamespaces,
                boolean inheritNamespaces,
                SchemaType schemaType,
                int validation)

Method Detail

### getInstructionNameCode

    public int getInstructionNameCode()

  Get the name of this instruction for diagnostic and tracing purposes

  Overrides:
    `getInstructionNameCode` in class `Instruction`

### analyze

    public Expression analyze(StaticContext env,
                              ItemType contextItemType)
                       throws XPathException

  Description copied from class: `InstructionWithChildren`
  Perform static analysis of an expression and its subexpressions.

  This checks statically that the operands of the expression have the correct type; if necessary it generates code to do run-time type checking or type conversion. A static type error is reported only if execution cannot possibly succeed, that is, if a run-time type error is inevitable. The call may return a modified form of the expression.

  This method is called after all references to functions and variables have been resolved to the declaration of the function or variable. However, the types of such functions and variables will only be accurately known if they have been explicitly declared.

  Specified by:
    `analyze` in interface `Expression`
  Overrides:
    `analyze` in class `InstructionWithChildren`
  Parameters:
    `env` - the static context of the expression
  Returns:
    the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
  Throws:
    `XPathException` - if an error is discovered during this phase (typically a type error)

### getItemType

    public ItemType getItemType()

  Get the item type of the result of this instruction.

  Specified by:
    `getItemType` in interface `Expression`
  Overrides:
    `getItemType` in class `ElementCreator`
  Returns:
    The context item type.

### getNameCode

    protected int getNameCode(XPathContext context)
                       throws XPathException

  Callback from ElementCreator when constructing an element

  Specified by:
    `getNameCode` in class `ElementCreator`
  Parameters:
    `context` -
  Returns:
    the namecode of the element to be constructed
  Throws:
    `XPathException`

### outputNamespaceNodes

    protected void outputNamespaceNodes(XPathContext context,
                                        Receiver receiver)
                                 throws XPathException

  Callback to output namespace nodes for the new element.

  Specified by:
    `outputNamespaceNodes` in class `ElementCreator`
  Parameters:
    `context` - The execution context
    `receiver` - the Receiver where the namespace nodes are to be written
  Throws:
    `XPathException`

### processLeavingTail

    public TailCall processLeavingTail(XPathContext context)
                                throws XPathException

  Description copied from class: `ElementCreator`
  Evaluate the instruction to produce a new element node

  Overrides:
    `processLeavingTail` in class `ElementCreator`
  Parameters:
    `context` -
  Returns:
    null (this instruction never returns a tail call)
  Throws:
    `XPathException`

### display

    public void display(int level,
                        NamePool pool,
                        java.io.PrintStream out)

  Diagnostic print of expression structure. The expression is written to the System.err output stream

  Parameters:
    `level` - indentation level for this expression
    `out` -
    `pool` - NamePool used to expand any names appearing in the expression