UStdExitedEvent.fromXML constructor

UStdExitedEvent.fromXML(
  1. String xmlSTR
)

Implementation

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

  return UStdExitedEvent(
    messageName: messageName,
    messageID: int.parse(messageID),
    user: user,
    workstation: workstation,
  );
}