findElements method

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

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 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:

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

Implementation

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