getElements method

List<XmlElement>? getElements(
  1. String elementName,
  2. {bool ignoreNestedMatches = true,
  3. int start = 0,
  4. int? stop}
)

Recursively checks all elements within this node tree and returns any elements found named elementName.

If ignoredNestedMatches is true, the children of any matching element will be ignored. If false, elements named elementName nested within elements named elementName will be returned in additional to their parent.

start and stop refer to the indexes of the identified elements. Only matches found between start and stop will be returned. start must not be null and must be >= 0. stop may be null, but must be >= start if provided.

Returns null if no elements can be found named elementName.

Implementation

List<XmlElement>? getElements(
  String elementName, {
  bool ignoreNestedMatches = true,
  int start = 0,
  int? stop,
}) {
  assert(elementName.isNotEmpty);
  assert(start >= 0);
  assert(stop == null || stop >= start);

  return getElementsWhere(
    name: elementName,
    ignoreNestedMatches: ignoreNestedMatches,
    start: start,
    stop: stop,
  );
}