DeviceAcquireRequest.fromXML constructor

DeviceAcquireRequest.fromXML(
  1. String xmlSTR
)

Implementation

factory DeviceAcquireRequest.fromXML(String xmlSTR) {
  final document = XmlDocument.parse(xmlSTR);
  String deviceName = document.rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "deviceName",
          orElse: orElseEmpty)
      .value;
  String deviceToken = document.rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "deviceToken",
          orElse: orElseEmpty)
      .value;
  String airlineID = document.rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "airlineID",
          orElse: orElseEmpty)
      .value;
  String msFoidMasking = document.rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "msFoidMasking",
          orElse: orElseEmpty)
      .value;
  String messageID = document.rootElement.attributes
      .firstWhere((p0) => p0.name.toString() == "messageID")
      .value;

  return DeviceAcquireRequest(
      deviceName: deviceName,
      deviceToken: deviceToken,
      airlineID: airlineID,
      msFoidMasking: msFoidMasking,
      messageID: int.parse(messageID));
}