Importing XML using the ParseURI Action

Action: ParseURI

M/DB:X is unusual in that it is not a validating parser. It will attempt to tidy up any XML or HTML that you import into it, and will construct its best attempt at a corresponding DOM from what it is given. This lenient parsing makes it ideal for importing "lazily"-specified HTML which you can then analyse, search and manipulate as a correctly-structured XML document.

Note: this lenient parsing does mean that the DOM constructed by M/DB:X may differ from what you expected when you imported a document, particularly if your document contains mismatched tags. However if M/DB:X is given a properly structured XML document, then it will accurately parse it and create a corresponding DOM.

Action-specific name/value pairs:

Parameter Name Description
DocumentName The name that you want assigned to the document if parsing completes successfully. If a document of the same name exists in M/DB:X, it will be automatically deleted. The name is case-sensitive.
URI URL/URI pointing to the resource to be imported, which should return either XML or HTML. Note that the URI must be correctly URL-escaped.
isHTML {optional) If this name/value pair is included and has a value of true, the content being parsed is assumed to be HTML and will be tidied up and converted to a XHTML-like format, with tag and attribute names converted to lower case etc.

By default, the content is assumed to be XML and no case conversion will take place.

Example Request

Action=ParseURI
&DocumentName=myExample
&MDBAccessKeyId=[your access key id]
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2009-06-14T13%3A19%3A41
&URI=http%3A//mgateway.s3.amazonaws.com/mdbxpathExample.xml
&Version=2009-04-15
&db=mdbx

Example Response

XML

<?xml version='1.0'?>
<ParseURIResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <ParseURIResult>
      <DocumentOID>
         6-1
      </DocumentOID>
   </ParseURIResult>
</ParseURIResponse>

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

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

{DocumentOID:"6-1"}

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