firstTag method

XMLNode? firstTag(
  1. String tag,
  2. {String? xmlns}
)

Returns the first xml node that matches the description:

  • node's tag is equal to tag
  • (optional) node's xmlns attribute is equal to xmlns Returns null if none is found.

Implementation

XMLNode? firstTag(String tag, {String? xmlns}) {
  return _firstTag((node) {
    if (xmlns != null) {
      return node.tag == tag && node.attributes['xmlns'] == xmlns;
    }

    return node.tag == tag;
  });
}