DErrEnteredEvent.fromXML constructor
DErrEnteredEvent.fromXML(
- String xmlSTR
Implementation
factory DErrEnteredEvent.fromXML(String xmlSTR) {
final document = XmlDocument.parse(xmlSTR);
String messageName = document.rootElement.attributes.firstWhere((p0) => p0.name.toString() == "messageName").value;
String messageID = document.rootElement.attributes.firstWhere((p0) => p0.name.toString() == "messageID").value;
XmlElement eventElement = document.rootElement.findAllElements("dErrEnteredEvent").first;
String device = eventElement.attributes.firstWhere((p0) => p0.name.toString() == "device", orElse: orElseEmpty).value;
String deviceType = eventElement.attributes.firstWhere((p0) => p0.name.toString() == "deviceType", orElse: orElseEmpty).value;
XmlElement statusElement = eventElement.childElements.where((element) => element.name.toString().endsWith("Status")).first;
Status status = Status.fromXML(statusElement.toXmlString());
return DErrEnteredEvent(
messageName: messageName,
messageID: int.parse(messageID),
status: status,
device: device,
deviceType: deviceType
);
}