Class ReplaceValue
java.lang.Object
org.basex.query.up.primitives.Update
org.basex.query.up.primitives.DataUpdate
org.basex.query.up.primitives.node.NodeUpdate
org.basex.query.up.primitives.node.ReplaceValue
ReplaceValue primitive. Replaces the value of a node.
If the target T is an element node this primitive represents a replaceElementContent expression (see XQUF). The children of T are deleted and a single (optional) text node is inserted as the only child of T. The primitive for replaceElementContent is substituted by [delete children(T), insertInto(T)].
After the end of the snapshot, T has either no child node at all (if the given text node has been empty), or the given (non-empty) text node as a single child. Attributes of T are not affected by a replaceElementContent expression.
If T is a text node and the new text value is empty, T is deleted.
- Author:
- BaseX Team 2005-21, BSD License, Lukas Kircher
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanStates if this primitive represents a replaceElementContent expression.Fields inherited from class org.basex.query.up.primitives.node.NodeUpdate
preFields inherited from class org.basex.query.up.primitives.DataUpdate
data -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the atomic update operations for this update primitive to the given list.voidMerges two update operations pointing to the same target.voidprepare(MemData memData, QueryContext qc) Prepares this update primitive before execution.intsize()Returns the number of update operations.substitute(MemData tmp) Substitutes the update primitive if necessary.toString()voidUpdates the name pool, which is used to find duplicate attributes and namespace conflicts.Methods inherited from class org.basex.query.up.primitives.node.NodeUpdate
nodeMethods inherited from class org.basex.query.up.primitives.DataUpdate
data
-
Field Details
-
rec
public final boolean recStates if this primitive represents a replaceElementContent expression.
-
-
Constructor Details
-
ReplaceValue
Constructor.- Parameters:
pre- target node PRE valuedata- target data referenceii- input infovalue- new value
-
-
Method Details
-
prepare
Description copied from class:NodeUpdatePrepares this update primitive before execution. This includes e.g. the preparation of insertion sequences.- Specified by:
preparein classNodeUpdate- Parameters:
memData- temporary data instanceqc- query context
-
merge
Description copied from class:UpdateMerges two update operations pointing to the same target.- Specified by:
mergein classUpdate- Parameters:
update- operation to merge with- Throws:
QueryException- exception
-
size
public int size()Description copied from class:UpdateReturns the number of update operations. -
toString
-
addAtomics
Description copied from class:NodeUpdateAdds the atomic update operations for this update primitive to the given list.- Specified by:
addAtomicsin classNodeUpdate- Parameters:
auc- list of atomic updates
-
substitute
Description copied from class:NodeUpdateSubstitutes the update primitive if necessary. For instance a 'Replace Value of' primitive called on a target T with T being an element results in a 'Replace Element Content' primitive with target T. As this is ugly to process it is substituted by delete primitives for every child of T and an 'Insert into' primitive if the length of the (optional!) text node is greater zero. When a primitive is substituted it is still added to the list itself to be able to throw exceptions when necessary. I.e. for multiple replaces on the same target node. These update primitives don't produce atomic updates, hence this won't affect the database.- Overrides:
substitutein classNodeUpdate- Parameters:
tmp- temporary mem data- Returns:
- An array that contains the substituting primitives or this update primitive if no substitution is necessary.
-
update
Description copied from class:NodeUpdateUpdates the name pool, which is used to find duplicate attributes and namespace conflicts.- Specified by:
updatein classNodeUpdate- Parameters:
pool- name pool
-