-
-
Notifications
You must be signed in to change notification settings - Fork 23
Search Keywords
William W. Kimball, Jr., MBA, MSIS edited this page Apr 19, 2021
·
18 revisions
In addition to Search Expressions, YAML Path also provides some search keywords since version 3.5.0. Like programming language keywords, these are reserved words written in a specific notation form so as to avoid interference with other YAML Path expressions.
The general form of a keyword-based search is [KEYWORD(PARAMETERS)]
with optional white-space, where:
- The outermost
[]
pair is mandatory. -
KEYWORD
is one of the reserved Available Keywords. - The following
()
pair is mandatory, even when no parameters are passed. -
PARAMETERS
is a comma-delimited set of parameters passed to the search keyword's function. In documentation, optional parameters are denoted by using a[]
pair around parameters which can be omitted when not needed.
The available Search Keywords include:
-
has_child(NAME)
: Match nodes having a named, immediate child. This can be inverted using the!
prefix. -
parent([STEPS])
: Step up to the present node's immediate parent, or take multiple STEPS. This cannot be inverted.