## com.saxonica.update
Class ReplaceAttributeAction

    java.lang.Object
      com.saxonica.update.ReplaceAttributeAction

All Implemented Interfaces:
  PendingUpdateAction

    public class ReplaceAttributeAction

extends java.lang.Object
implements PendingUpdateAction

A pending update action representing a replace node expression applied to an attribute. Note that the replacement attribute may be absent; this is not quite the same as a delete operation, because the consistency rules on the pending update list are different.

Constructor Summary
`ReplaceAttributeAction(NodeInfo element, int oldNameCode, int newNameCode, int typeCode, java.lang.CharSequence value, int properties)` Create a InsertAttributeAction

Method Summary
`void` `apply(XPathContext context, java.util.Set affectedRootSet)` Apply the pending update action to the affected nodes
`int` `getApplyPhase()` Get the phase of operation in which this pending update action is applied.
`int` `getNewNameCode()` Get the name of the inserted attribute as an integer namecode
`int` `getOldNameCode()` Get the name of the replaced attribute as an integer namecode
`NodeInfo` `getTargetNode()` Get the target node of the update action

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

Constructor Detail

### ReplaceAttributeAction

    public ReplaceAttributeAction(NodeInfo element,
                                  int oldNameCode,
                                  int newNameCode,
                                  int typeCode,
                                  java.lang.CharSequence value,
                                  int properties)

  Create a InsertAttributeAction

  Parameters:
    `element` - the element into which it is to be inserted
    `oldNameCode` - the name of the old attribute
    `newNameCode` - the name of the new attribute, or -1 if there is no new attribute
    `typeCode` - the type annotation of the new attribute, or -1 if there is no new attribute
    `value` - the string value of the new attribute, or null if there is no new attribute
    `properties` - properties including IS_ID and IS_IDREF properties

Method Detail

### apply

    public void apply(XPathContext context,
                      java.util.Set affectedRootSet)
               throws XPathException

  Apply the pending update action to the affected nodes

  Specified by:
    `apply` in interface `PendingUpdateAction`
  Parameters:
    `context` - the XPath evaluation context
    `affectedRootSet` - the set of roots of trees that have been modified, which this action should add to as necessary
  Throws:
    `XPathException` - if any error occurs applying the update

### getTargetNode

    public NodeInfo getTargetNode()

  Get the target node of the update action

  Specified by:
    `getTargetNode` in interface `PendingUpdateAction`
  Returns:
    the target node, the node to which this update action applies. Returns null in the case of a delete action, which affects multiple nodes.

### getOldNameCode

    public int getOldNameCode()

  Get the name of the replaced attribute as an integer namecode

  Returns:
    the name of the attribute being replaced

### getNewNameCode

    public int getNewNameCode()

  Get the name of the inserted attribute as an integer namecode

  Returns:
    the new name as an integer namecode, or -1 if the attribute is to be deleted without replacement

### getApplyPhase

    public int getApplyPhase()

  Get the phase of operation in which this pending update action is applied. See 3.2.2 upd:applyUpdates, Semantics, rule 2.

  Specified by:
    `getApplyPhase` in interface `PendingUpdateAction`
  Returns:
    the phase of operation, an integer in the range 1 to 5 representing the stages labelled a-e in the specification

Copyright (c) Saxonica Limited. All rights reserved.