GetElementsByTagName

Description

Retrieves all the elements in the XML document that have the specified TagName.

Syntax

pbdom_object_name.GetElementsByTagName(string strTagName, ref pbdom_element pbdom_element_array[])

Argument

Description

strTagName

The TagName of the elements to be searched for

pbdom_element_array[]

A reference to a PBDOM_ELEMENT object array that has the specified TagName


Return value

Boolean.

GetElementsByTagName returns true for success and false if an exception occurs.

Examples

Assume a PBDOM_DOCUMENT contains the following XML fragment:

<book>
   <title>The Winter's Tale</title>
   <author>William Shakespeare</author>
   <price>7.95</price>
   <quantity>1</quantity>
</book>
<book>
   <title>Le Lecon</title>
   <author>Eugene Ionesco</author>
   <price>10.95</price>
   <quantity>1</quantity>
</book>
<book>
   <title>Deutsches Tempo</title>
   <author>Kurt Tucholsky</author>
   <price>13.95</price>
   <quantity>1</quantity>
</book>

The following statements extract the list of titles from the document and display it in a multilineedit control:

pbdom_document doc
pbdom_element element[]

// doc contains role elements
boolean bb_bool

bb_bool = doc.getelementsbytagname("title",element[])

integer ii_bound, i

ii_bound = upperbound(element)
for i = 1 to ii_bound
   mle_1.text += element[i].gettext() + "~r~n"
next