I am trying to access specific XML tag names from an Iterable Stream of XML Events. Is there a way as I can only find a way to print the text of each XmlEvent irrespective of tag/element name? Below my code.
Future<String> getDataFromXml() async {
String xmlString = await DefaultAssetBundle.of(context)
.loadString('assets/gpx/filename');
var events = parseEvents(xmlString).whereType<XmlTextEvent>();
Stream.fromIterable(events)
.where((event) => event is XmlEvent)
.cast<XmlEvent>()
.forEach(print);
I understand how to access the elements from a parsed XML document (which is not a stream), but not from a stream of XML events.