findAllElements method Null safety

Iterable<XmlElement> findAllElements(
  1. String name,
  2. {String? namespace}

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

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:

  • document.findAllElements('xsd:annotation') finds all elements with the fully qualified tag name xsd:annotation.
  • document.findAllElements('annotation', namespace: '*') finds all elements with the local tag name annotation no matter their namespace.
  • document.findAllElements('*', namespace: '') finds all elements with the given namespace URI.


Iterable<XmlElement> findAllElements(String name, {String? namespace}) =>
    filterElements(descendants, name, namespace);