CuppsBase.fromXML constructor

CuppsBase.fromXML(
  1. String xmlSTR
)

Implementation

factory CuppsBase.fromXML(String xmlSTR) {
  final document = XmlDocument.parse(xmlSTR);

  String messageName = document.rootElement.attributes
      .firstWhere((p0) => p0.name.toString() == "messageName")
      .value;
  // String xmlns = document.rootElement.attributes.firstWhere((p0) => p0.name.toString().startsWith("xmlns")).value;
  String messageID = document.rootElement.attributes
      .firstWhere((p0) => p0.name.toString() == "messageID")
      .value;
  // String xsi = document.rootElement.attributes.firstWhere((p0) => p0.name.toString() == "xmlns:xsi").value;

  return CuppsBase(
    messageName: messageName,
    messageID: int.parse(messageID),
    // xsi: xsi,
    // xmlns: xmlns,
  );
}