getElement method

XmlElement? getElement(
  1. String name, {
  2. @Deprecated('Use `namespaceUri` instead') String? namespace,
  3. String? namespaceUri,
})
inherited

Return the first child element with the given name, or null.

Both name and namespaceUri 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.getElement('xsd:name') returns the first element with the fully qualified tag name xsd:name.
  • element.getElement('name', namespaceUri: '*') returns the first element with the local tag name name no matter the namespace.
  • element.getElement('*', namespaceUri: 'http://www.w3.org/2001/XMLSchema') returns the first element within the provided namespace URI.

Implementation

XmlElement? getElement(
  String name, {
  @Deprecated('Use `namespaceUri` instead') String? namespace,
  String? namespaceUri,
}) => null;