toXml method
Implementation
@override
void toXml(XmlBuilder context, NamespaceManager nsmgr) {
final Map<String, String?> namespaces;
final namespace = this.namespace;
switch (namespace) {
case null:
namespaces = const {};
case "":
namespaces = const {"": null};
default:
if (!nsmgr.contain(namespace)) {
namespaces = {namespace: nsmgr.generate(namespace)};
} else {
namespaces = const {};
}
}
final value = this.value;
final lang = this.lang;
context.element(
name,
namespace: namespace,
namespaces: namespaces,
attributes: lang != null ? {kXmlLangAttrName: lang} : const {},
nest: value != null ? () => value.toXml(context, nsmgr) : null,
);
}