getChildElements static method
Given a tag(name) returns all child elements of a XmlElement that match
Implementation
static List<XmlElement>? getChildElements({required XmlElement node, required String tag})
{
try
{
String lower = tag.toLowerCase();
String upper = tag.toUpperCase();
List<XmlElement> list = [];
var nodes = node.findElements(tag, namespace: "*");
if (nodes.isNotEmpty) list.addAll(nodes);
///////////////
/* Lowercase */
////////////////
if (tag != lower)
{
nodes = node.findElements(lower, namespace: "*");
if (nodes.isNotEmpty) list.addAll(nodes);
}
///////////////
/* Uppercase */
///////////////
if (tag != upper)
{
nodes = node.findElements(upper, namespace: "*");
if (nodes.isNotEmpty) list.addAll(nodes);
}
return list;
}
catch(e)
{
Log().exception(e, caller: 'xml.dart => XmlElement getChildElement({XmlElement node, String tag})');
}
return null;
}