Action: InsertNewIntermediateElement

Purpose: Time-saving shortcut Action to create a new Element and insert it between a specified Node and its Child Nodes. This Action avoids the need for several primitive DOM Actions

For example, suppose we had the following sub-tree in our XML document:

 <div id='a123'>
   <myTag1>
    <mySubTag2>Some text
   </myTag1>
   <myTag2 />
   <myTag3 id="b2">
    <mySubTag />
   </myTag3>
 </div>

Applying the InsertNewIntermediateElement Action to the <div> tag to create a new Element with a TagName of <MyIntermediateNode> would result in:

 <div id='a123'>
  <MyIntermediateNode>
   <myTag1>
    <mySubTag2>Some text
   </myTag1>
   <myTag2 />
   <myTag3 id="b2">
    <mySubTag />
   </myTag3>
  </MyIntermediateNode>
 </div>

Action-specific name/value pairs:

Parameter Name Description
TagName The TagName of the new Element you want to create
ParentOID The OID of the Node to which the new Element will be added as an intermediate Node.

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

{TagName:"MyIntermediateNode",ParentOID:"1-3"}

Example Request

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

or:

Action=InsertNewIntermediateElement
&JSON=%7BTagName%3A%22MyIntermediateNode%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

Example Response

XML

<?xml version='1.0'?>
<InsertNewIntermediateElementResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <InsertNewIntermediateElementResult>
      <ElementOID>
         1-11
      </ElementOID>
   </InsertNewIntermediateElementResult>
</InsertNewIntermediateElementResponse>

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

{ElementOID:"1-11"}

In the example above, the NodeOID allocated to the newly created Element is 1-11.