AuthenticateRequest.fromXML constructor

AuthenticateRequest.fromXML(
  1. String xmlSTR
)

Implementation

factory AuthenticateRequest.fromXML(String xmlSTR) {
  final document = XmlDocument.parse(xmlSTR);
  String messageID = document.rootElement.attributes
      .firstWhere((p0) => p0.name.toString() == "messageID")
      .value;
  String xmlns = document.rootElement.attributes
      .firstWhere((p0) => p0.name.toString() == "xmlns")
      .value;
  String xsi = document.rootElement.attributes
      .firstWhere((p0) => p0.name.toString() == "xmlns:xsi")
      .value;
  String airline = document.rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "airline")
      .value;
  String eventToken = document.rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "eventToken")
      .value;
  String platformDefinedParameter = document
      .rootElement.childElements.first.attributes
      .firstWhere((p0) => p0.name.toString() == "platformDefinedParameter")
      .value;
  List<Application> applicationsList = document
      .rootElement.firstChild!.firstChild!.children
      .map((e) => Application.fromXML(e.toString()))
      .toList();
  return AuthenticateRequest(
      xsi: xsi,
      xmlns: xmlns,
      airline: airline,
      eventToken: eventToken,
      applications: applicationsList,
      platformDefinedParameter: platformDefinedParameter,
      messageID: int.parse(messageID));
}