WAltEnteredEvent.fromXML constructor

WAltEnteredEvent.fromXML(
  1. String xmlSTR
)

Implementation

factory WAltEnteredEvent.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("wAltEnteredEvent").first;
  String admin = eventElement.attributes.firstWhere((p0) => p0.name.toString() == "admin", orElse: orElseEmpty).value;
  String message = eventElement.attributes.firstWhere((p0) => p0.name.toString() == "message", orElse: orElseEmpty).value;
  String workstation =
      eventElement.attributes.firstWhere((p0) => p0.name.toString() == "workstation", orElse: orElseEmpty).value;

  return WAltEnteredEvent(
    messageName: messageName,
    messageID: int.parse(messageID),
    admin: admin,
    message: message,
    workstation: workstation,
  );
}