childrenToMap method

Map<String, List<XMLBody>> childrenToMap()

Implementation

Map<String, List<XMLBody>> childrenToMap() {
  if (body is XMLChildren) {
    XMLChildren childrenBody = body as XMLChildren;
    Map<String, List<XMLBody>> result = {};

    for (var child in childrenBody.body) {
      if (child.body != null) {
        result.putIfAbsent(child.tag, () => []).add(child.body!);
      }
    }

    return result;
  } else {
    return {};
  }
}