findElements method

  1. @override
Iterable<XmlElement> findElements(
  1. String name, {
  2. String? namespace,
})
inherited

Return a lazy Iterable of the direct child elements in document order with the specified tag name and namespace.

Both name and namespace can be set to a specific String or '*' to match anything. If no namespace is provided, the fully qualified name will be matched, otherwise only the local name is compared.

For example:

  • element.findElements('xsd:annotation') finds all direct child elements with the fully qualified tag name xsd:annotation.
  • element.findElements('annotation', namespace: '*') finds all direct child elements with the local tag name annotation no matter their namespace.
  • element.findElements('*', namespace: 'http://www.w3.org/2001/XMLSchema') finds all direct child elements within the provided namespace URI.

Implementation

@override
Iterable<XmlElement> findElements(String name, {String? namespace}) =>
    filterElements(children, name, namespace);