Action: GetElementById

Purpose: Returns a pointer to the Element whose id attribute matches the specified value.

The id attribute is handled specially in the XML DOM, in that it is specifically indexed. Note that it is your responsibility to ensure that DOM id values are unique: M/DB:X will not attempt to enforce id uniqueness automatically. This Action is one of the most commonly used when manipulating and transforming DOMs.

Action-specific name/value pairs:

Parameter Name Description
id The value of the id attribute whose owner Element you want to retrieve.
DocumentName or DocumentOID The Name or OID of the document in which you want to make the search.

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

{Id:"a123",DocumentName:"example"}

Example Request

Action=GetElementById
&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
&id=a123

or:

Action=GetElementById
&JSON=%7BId%3A%22a123%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'?>
<GetElementByIdResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <GetElementByIdResult>
      <ElementOID>
         1-4
      </ElementOID>
   </GetElementByIdResult>
</GetElementByIdResponse>

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

{ElementOID:"1-4"}