setAttribute static method
Changes an XmlElement attribute value
Implementation
static void setAttribute(XmlElement node, String tag, String? value) {
try {
value ??= "";
value.replaceAll('"', """);
value.replaceAll("'", """);
XmlAttribute? a = node.getAttributeNode(tag);
if (a == null) {
node.attributes.add(XmlAttribute(XmlName(tag), value));
} else {
a.value = value;
}
} catch (e) {
Log().exception(e,
caller:
'xml.dart => String attribute({XmlElement node, String tag})');
}
}