getAttrValue method

String getAttrValue({
  1. required XmlElement element,
  2. required String nodePath,
  3. required String attributeName,
})

获取属性值 element XmlElement nodePath 节点路径 eg. root->node1->node2->node3 attributeName 元素属性名

Implementation

String getAttrValue({required XmlElement element, required String nodePath, required String attributeName}) {
  if (attributeName.isEmptyString) {
    return "";
  }
  var xmlElement = getElement(element: element, nodePath: nodePath);
  return xmlElement?.getAttribute(attributeName) ?? "";
}