parseXML method
Implementation
void parseXML(String xml) {
try {
XmlDocument doc = XmlDocument.parse(xml);
log(doc.toXmlString(preserveWhitespace: (_) => true, pretty: true));
// String headerShouldBe = ( xml).split("<").first;
// bool messageENDED = xml.endsWith("</cupps>");
// String received = ( xml).replaceFirst(headerShouldBe, "");
// // print("received $received from Platform");
//
// if (messageENDED) {
// // print("MESSAGE COMPLETE");
// XmlDocument doc = XmlDocument.parse(xml);
// XmlElement resElement = doc.rootElement.findAllElements("deviceStatusNotification").first;
// XmlElement statusElement =
// resElement.childElements.where((element) => element.name.toString().endsWith("Status")).first;
//
// BpStatus status = BpStatus.fromXML(statusElement.toXmlString());
// log("RECEIVED bp Status Notification $status");
// } else {
// log("MESSAGE IS COMING");
// }
} catch (e) {
log("$e--->\n$xml");
}
}