Returns an element that is a child of the specified element and comply with the specified target Element Type(s).
This function returns the same result as the following expression:
findChildren(element, elementTypeSpec).next()
Parameters:
element
The element whose child is requested.If not specified, the generator context element is assumed, i.e. the same as the call:
contextElement.findChild(elementTypeSpec)
See Also:
GOMContext.contextElement
elementTypeSpec
The list of target Element Types (see "Specifying Matching Element Types" below).The returned element will comply with at least one of the target Element Types.
filterQuery
Specify an additional 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 returntrue
if the element should be returned andfalse
if it should be ignored. The tested element is passed as the generator context element.
Returns:
The found child element.If the specified parent element has multiple children complying with the specified target Element Types, the first of them will be returned.
If no request child element found (or
element == null
), the function returnsnull
.
See Also:
hasChild(), findChildren(), findAncestor(), findElementByLPath()
Tip:
When you know that the element must have one child of a certain type,
findChild()
function is the fastest and easiest way to access it.
Use also getAttrValue()
function to access the child's attribute,
for example:
class.findChild ( "SourcePosition" ).getAttrValue("fileDir")
${include ../../../refs/matching_ets_spec.htm}
${include ../../../refs/element_types.htm}