Importing XML using the NewXMLDocument Action

Action: NewXMLDocument

Action-specific name/value pairs:

Parameter Name Description
DocumentName The name that you want assigned to the new document. If a document of the same name exists in M/DB:X, it will be automatically deleted. The name is case-sensitive.
OuterTagName The name of the outer tag (DocumentElement) that will be created for this DOM.
addPI (optional) If this name/value pair is included and has a value of false, an XML Processing Instruction will not be added to the top of the document.

By default, a standard XML processing instruction of the format <?xml version='1.0' encoding='UTF-8'?> will be added to the top of the document. You can modify or replace this at a later stage of DOM processing, or you can add your own Processing Instruction.

Example Request

Action=NewXMLDocument
&DocumentName=myExample
&MDBAccessKeyId=[your access key id]
&OuterTagName=myTestDocument
&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'?>
<NewXMLDocumentResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <NewXMLDocumentResult>
      <DocumentOID>
         7-1
      </DocumentOID>
   </NewXMLDocumentResult>
</NewXMLDocumentResponse>

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

{DocumentOID:"7-1"}

The XML was created without error and a DOM created with a DocumentOID of "7-1" and DocumentName of "myExample"

This newly created document will look like this:
<?xml version='1.0' encoding='UTF-8'?>
<myTestDocument />

Normally this skeleton document would be extended and modified using the other DOM API methods that are available as M/DB:X Actions. M/DB:X can therefore be used to build XML documents entirely programmatically.