Action: GetElementsByTagName

Purpose: Returns pointers to all Elements whose TagName property matches the specified value.

You can search the entire document, in which case you should specify the DocumentName or DocumentOID, or you can limit your search to a specific NodeOID, in which case the search for matching tags will be limited to the sub-tree of nodes under the specified node.

Note: If you know that there is only one instance of the named tag in the document, eg <body>, then you can use the GetElementByTagName Action instead.

Action-specific name/value pairs:

Parameter Name Description
TagName The TagName of the Elements you wish to retrieve. For example, if you wanted to find all <div> tags, the TagName would be div. Note that in XML documents, the TagName is case-sensitive.
DocumentName or DocumentOID (optional*) The Name or OID of the document in which you want to make the search. If you specify this parameter, then the entire DOM is searched for matching tags.
FromNodeOID (optional*) The OID of the node within whose subtree of child nodes you want to limit the search.

* You must specify one or other of these parameters, but not both.

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

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

Example Request

Action=GetElementsByTagName
&FromNodeOID=1-4
&MDBAccessKeyId=[your access key id]
&Signature=[computed signature]
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&TagName=div
&Timestamp=2009-06-14T13%3A19%3A41
&Version=2009-04-15
&db=mdbx

or:

Action=GetElementsByTagName
&JSON=%7BTagName%3A%22div%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'?>
<GetElementsByTagNameResponse xmlns="http://mdbx.mgateway.com/doc/2009-06-05/">
   <GetElementsByTagNameResult>
      <ElementOID>
         1-20
      </ElementOID>
      <ElementOID>
         1-25
      </ElementOID>
   </GetElementsByTagNameResult>
</GetElementsByTagNameResponse>

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

["1-20","1-25"]