Action: CreateProcessingInstruction

Purpose: Creates a new Processing Instruction Node and optionally appends it into its owner DOM.

If you don't attach the newly created node, you can attach it to its DOM tree at a later time using either the AppendChild or InsertBefore Action

You need to specify the Target and Data properties of the Processing Instruction Node. For example, if you want to create the following Processing Instruction node:

<?xml version='1.0' ?>

Target = xml
Data = version='1.0'

Action-specific name/value pairs:

Parameter Name Description
Target The Target property of the Processing Instruction Node.
Data The Data content of the Processing Instruction Node. This must be correctly URL-escaped as appropriate.
DocumentName or DocumentOID The Name or OID of the DOM in which you wish to create the new Node.
AppendTo (optional) The OID of the Node to which the newly-created Node will be appended as a Last Child. If not specified, the newly created Node will be left unattached in the Document.

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

{Target:"xml",Data:"version='1.0'",DocumentName:"example",AppendTo:"1-1"}

Example Request

v
Action=CreateProcessingInstruction
&Data=version%3D'1.0'
&DocumentName=example
&MDBAccessKeyId=[your access key id]
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Target=xml
&Timestamp=2009-06-14T13%3A19%3A41
&Version=2009-04-15
&db=mdbx

or:

Action=CreateProcessingInstruction
&JSON=%7BTarget%3A%22xml%22%2CData%3A%22version%3D'1.0'%22%2CDocumentName%3A%22example%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'?>
<CreateProcessingInstructionResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <CreateProcessingInstructionResult>
      <NodeOID>
         1-33
      </NodeOID>
      <NodeType>
         7
      </NodeType>
   </CreateProcessingInstructionResult>
</CreateProcessingInstructionResponse>

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

{NodeOID:"1-33",NodeType:7}

The OID assigned to the newly-created Comment Node was 1-33. Note that the NodeType (Processing Instruction = 7) is also returned for information only.