hasAttribute static method

bool hasAttribute({
  1. required XmlElement node,
  2. required String tag,
})

Given an XmlElement and an attribute tag(name) we will return true if exists

Implementation

static bool hasAttribute({required XmlElement node, required String tag}) {
  try {
    if (node.getAttributeNode(tag) != null) return true;
    //if (node.getAttributeNode(tag.toLowerCase()) != null) return true;
    //if (node.getAttributeNode(tag.toUpperCase()) != null) return true;
  } catch (e) {
    Log().exception(e,
        caller:
            'xml.dart => String attribute({XmlElement node, String tag})');
  }
  return false;
}