Action: AppendChild

Purpose: Appends a previously unattached Node (and its sub-tree of child Nodes if present) as the new Last Child of a specified parent Node in a DOM.

The OID of the Node that was appended will be returned in the response. Note that this NodeOID will be the same as before it was attached.

Note that when nodes are created using the primitive Createtype Actions, they are associated with a Document but are not actually attached to the DOM tree. Until attached, such new Nodes will not appear if the OutputDOM Action is invoked, since this recursively lists all nodes attached under the DOM's DocumentNode.

Attempts to append a Node that already has a ParentNode will return an error

A Node cannot be attached to a Node that belongs to a different Document. See the ImportNode and CopyNodes Actions if you are working between DOMs.

Action-specific name/value pairs:

Parameter Name Description
NodeOID The OID of the currently unattached node that is to be appended into the DOM
ParentOID The OID of the Node to which the unattached node will be appended as a Last Child.

Alternatively, the parameters above can be incorporated into a single JSON string and specified using the parameter name JSON, eg:

{NodeOID:"1-10",ParentOID:"1-3"}

Example Request

Action=AppendChild
&MDBAccessKeyId=[your access key id]
&NodeOID=1-10
&ParentOID=1-3
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2009-06-14T13%3A19%3A41
&Version=2009-04-15
&db=mdbx

or:

Action=AppendChild
&JSON=%7BNodeOID%3A%221-10%22%2CParentOID%3A%221-3%22%7D
&MDBAccessKeyId=[your access key id]
&OutputFormat=JSON
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2009-06-14T13%3A19%3A41
&Version=2009-04-15
&db=mdbx

This request will append Node 1-10 as the new Last Child of the Node whose OID is 1-3. Any child nodes that are attached to node 1-10 will also now be present in the DOM as a result of this Action.

Example Response

XML

<?xml version='1.0'?>
<AppendChildResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <AppendChildResult>
      <NodeOID>
         1-10
      </NodeOID>
   </AppendChildResult>
</AppendChildResponse>

JSON (ie if OutputFormat=JSON specified in the Request)

{NodeOID:"1-10"}