Action: CreateDocumentType

Purpose: Creates a new Document Type 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 Qualified Name and optionally the PublicId and/or SystemId of the Document Type Node. For example, if you want to create the following Document Type node:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

QualifiedName = html
PublicID = -//W3C//DTD XHTML 1.0 Strict//EN
SystemId = http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd

Action-specific name/value pairs:

Parameter Name Description
QualifiedName The Document Type Node's Qualified Name.
PublicId (Optional) The Document Type Node's PublicId. This must be appropriately URL-escaped if necessary
SystemId (optional) The Document Type Node's SystemId. This must be appropriately URL-escaped if necessary
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:

{QualifiedName:"html",PublicId:"-//W3C//DTD XHTML 1.0 Strict//EN",
 SystemId:"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd",DocumentName:"example",
 AppendTo:"1-1"}

Example Request

Action=CreateDocumentType
&DocumentName=example
&MDBAccessKeyId=[your access key id]
&PublicId=-//W3C//DTD%20XHTML%201.0%20Strict//EN
&QualifiedName=html
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&SystemId=http%3A//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
&Timestamp=2009-06-14T13%3A19%3A41
&Version=2009-04-15
&db=mdbx

or:

Action=CreateDocumentType
&JSON=%7BQualifiedName%3A%22html%22%2CPublicId%3A%22-//W3C//DTD%20XHTML%201.0%20Strict//EN%22%2C
 SystemId%3A%22http%3A//www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd%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'?>
<CreateDocumentTypeResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <CreateDocumentTypeResult>
      <NodeOID>
         1-31
      </NodeOID>
      <NodeType>
         10
      </NodeType>
   </CreateDocumentTypeResult>
</CreateDocumentTypeResponse>

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

{NodeOID:"1-31",NodeType:10}

The OID assigned to the newly-created Comment Node was 1-31. Note that the NodeType (Document Type = 10) is also returned for information only.