Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : INSERT-BEFORE( ) method
 

INSERT-BEFORE( ) method

Insert a node as a child of this document before another node (or last if the other node is unknown). This is one way to place the node into the document structure after the node has been created with the CREATE-NODE( ) or CREATE-NODE-NAMESPACE( ) method, cloned with the CLONE-NODE( ) method, or removed with the REMOVE-NODE( ) method. (Similar to the APPEND-CHILD( ) method.)
Return type: LOGICAL
Applies to: X-document object handle, X-noderef object handle

Syntax

INSERT-BEFORE ( x-ref-handle1 , x-ref-handle2 )
x-ref-handle1
The handle that represents the node to insert as a child of this document.
x-ref-handle2
A handle that represents the XML node that the node is to be inserted before. If unknown, the node will be appended as the last child.
The following code fragment demonstrates the use of the INSERT-BEFORE( ) method. hNoderefParent ends up with hNoderef and hNoderef2 in that order:
. . .
hDoc:CREATE-NODE(hNoderef,bufField:NAME,"ELEMENT").
hNoderefParent:INSERT-BEFORE(hNoderef,hNoderef2).
. . .