configurationsFromXml<T> function
The configurations of a notification configuration are the direct children
of the <NotificationConfiguration> element, one element per
configuration.
A server that wraps them in an element of their own is read as well, so a document written by an older version of this package is not lost.
Implementation
List<T>? configurationsFromXml<T>(
XmlElement? xml,
String elementName,
T Function(XmlElement? xml) parse, {
String? wrapperName,
String? wrapperItemName,
}) {
if (xml == null) return null;
final configurations = <T>[];
for (final child in xml.findElements(elementName)) {
configurations.add(parse(child));
}
if (configurations.isEmpty && wrapperName != null) {
final wrapper = getProp(xml, wrapperName);
if (wrapper != null) {
for (final child in wrapper.findElements(
wrapperItemName ?? elementName,
)) {
configurations.add(parse(child));
}
}
}
return configurations;
}