Map<String, String> attributeMap(Element element)

Source

Map<String, String> attributeMap(Element element) {
  var result = <String, String>{};
  result.addAll(element.attributes);
  // TODO(tbosch): element.getNamespacedAttributes() somehow does not return the attribute value
  var xlinkHref =
      element.getAttributeNS('http://www.w3.org/1999/xlink', 'href');
  if (xlinkHref != null) {
    result['xlink:href'] = xlinkHref;
  }
  return result;
}