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()
element
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 returned element will comply with at least one of the target Element Types.
filterQuery
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.
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 returns null
.
hasChild(), findChildren(), findAncestor(), findElementByLPath()
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")