MsStatus.fromXML constructor

MsStatus.fromXML(
  1. String xmlSTR
)

Implementation

factory MsStatus.fromXML(String xmlSTR) {
  final document = XmlDocument.parse(xmlSTR);
  String desc = document.firstChild!.attributes
      .firstWhere((element) => element.name.toString() == "desc",
          orElse: orElseEmpty)
      .value;
  String init = document.firstChild!.attributes
      .firstWhere((element) => element.name.toString() == "init")
      .value;
  String powerOff = document.firstChild!.attributes
      .firstWhere((element) => element.name.toString() == "powerOff")
      .value;
  String ready = document.firstChild!.attributes
      .firstWhere((element) => element.name.toString() == "ready")
      .value;
  String unknown = document.firstChild!.attributes
      .firstWhere((element) => element.name.toString() == "unknown")
      .value;
  return MsStatus(
      desc: desc,
      init: init,
      powerOff: powerOff,
      ready: ready,
      unknown: unknown);
}