findAllElements method

Iterable<XmlElement> findAllElements(
  1. String name, {
  2. String? namespaceUri,
  3. @Deprecated('Use `namespaceUri` instead') 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 a specific String; or '*' to match anything. If no namespace is provided, the fully qualified name is compared; otherwise only the local name is considered.

For example:

  • document.findAllElements('xsd:name') finds all elements with the fully qualified tag name xsd:name.
  • document.findAllElements('name', namespaceUri: '*') finds all elements with the local tag name name no matter their namespace.
  • document.findAllElements('*', namespaceUri: 'http://www.w3.org/2001/XMLSchema') finds all elements with the given namespace URI.

Implementation

Iterable<XmlElement> findAllElements(
  String name, {
  String? namespaceUri,
  @Deprecated('Use `namespaceUri` instead') String? namespace,
}) => _filterElements(
  descendants,
  name,
  namespaceUri: namespaceUri ?? namespace,
);