DeviceLockResponse.fromXML constructor

DeviceLockResponse.fromXML(
  1. String xmlSTR
)

Implementation

factory DeviceLockResponse.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;
  String result = document.rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "result")
      .value;
  XmlElement? deviceLockerInfoElement =
      document.rootElement.firstChild!.getElement("deviceLockerInfo");
  DeviceLockerInfo? deviceLockerInfo = deviceLockerInfoElement == null
      ? null
      : DeviceLockerInfo.fromXML(deviceLockerInfoElement.toXmlString());

  return DeviceLockResponse(
      messageName: messageName,
      messageID: int.parse(messageID),
      result: result,
      deviceLockerInfo: deviceLockerInfo);
}