Action: GetElementByTagName

Purpose: Returns a pointer to the Element whose TagName property matches the specified value.

This Action is useful if you know that there is only one instance of a specifically named tag in the DOM, eg <body>. If there are more than one instances of the named tag, then this Action may not return the instance you expect: in such circumstances you should use the GetElementsByTagName Action instead to retrieve pointers to all matching Elements.

Action-specific name/value pairs:

Parameter Name Description
TagName The TagName of the Element you wish to retrieve. For example, if you wanted to find the <body> tag, the TagName would be body. Note that in XML documents, the TagName is case-sensitive.
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:

{TagName:"body",DocumentName:"example"}

Example Request

Action=GetElementByTagName
&DocumentName=example
&MDBAccessKeyId=[your access key id]
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&TagName=body
&Timestamp=2009-06-14T13%3A19%3A41
&Version=2009-04-15
&db=mdbx

or:

Action=GetElementByTagName
&JSON=%7BTagName%3A%22body%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'?>
<GetElementByTagNameResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <GetElementByTagNameResult>
      <ElementOID>
         1-20
      </ElementOID>
   </GetElementByTagNameResult>
</GetElementByTagNameResponse>

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

{ElementOID:"1-20"}