encodeAttributes static method

String encodeAttributes(
  1. Map<String, dynamic> attr
)

Encodes attributes from a map to an XML String

Implementation

static String encodeAttributes(Map<String, dynamic> attr) {
  final buff = StringBuffer();
  for (var key in attr.keys) {
    buff.write('<attribute><name>$key</name>'
        '<value>${attr[key]}</value></attribute>');
  }
  return buff.toString().replaceAll('>', '&gt;').replaceAll('<', '&lt;');
}