elementById method
The element whose Id/ID/id attribute is id, or null.
Implementation
XmlLiteElement? elementById(String id) {
XmlLiteElement? find(XmlLiteElement e) {
for (final a in e.attributes) {
if ((a.localName == 'Id' ||
a.localName == 'ID' ||
a.localName == 'id') &&
a.value == id) {
return e;
}
}
for (final c in e.childElements) {
final hit = find(c);
if (hit != null) return hit;
}
return null;
}
return find(root);
}