Action: CreateTextNode

Purpose: Creates a new Text 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

Text Nodes should be appended to Element Nodes to represent the text inside an XML tag.

Action-specific name/value pairs:

Parameter Name Description
Data The Data content of the Text 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:

{Data:"This is some text",DocumentName:"example",AppendTo:"1-1"}

Example Request

Action=CreateTextNode
&Data=This%20is%20some%20text
&DocumentName=example
&MDBAccessKeyId=[your access key id]
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2009-06-14T13%3A19%3A41
&Version=2009-04-15
&db=mdbx

or:

Action=CreateTextNode
&JSON=%7BData%3A%22This%20is%20some%20text%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'?>
<CreateTextNodeResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <CreateTextNodeResult>
      <NodeOID>
         1-34
      </NodeOID>
      <NodeType>
         3
      </NodeType>
   </CreateTextNodeResult>
</CreateTextNodeResponse>

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

{NodeOID:"1-34",NodeType:3}

The OID assigned to the newly-created Text Node was 1-34. Note that the NodeType (Text = 3) is also returned for information only.