Searches the specified array (or vector) for the first occurrence of an element that complies with the filter condition.

Parameters:

elements

The array (or vector) to be searched.

Note: The array (or vector) is expected to contain objects representing DSM (Data Source Model) elements, that is GOMElement or DSMElement objects. Objects of any other types will be ignored.

filterQuery
Specify the filter condition on the returned element.

This should be a boolean subquery created with BooleanQuery() function. The subquery will be processed against each initially selected element. It must return true if the element should be returned and false if it should be ignored. The tested element is passed as the generator context element.

Returns:

The first element in the specified array (or vector) that complies with the filter condition.

If no such an element found (or elements == null), the function returns null.

Example:

The following expression searched the specified vector (or array) for the first occurrence of an element with 'xs:group' type:


findElementByFilter(
  elements,
  BooleanQuery (instanceOf ("xs:group"))
)
Note, that expression returns actually the same result as the call:

findElementByType (elements, "xs:group")

See Also:

BooleanQuery(), findElementByType()