ReaderReadResponse.fromXML constructor
ReaderReadResponse.fromXML(
- String xmlSTR
Implementation
factory ReaderReadResponse.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;
XmlElement resElement = document
.findAllElements(messageName)
.first;
String result = resElement.attributes
.firstWhere((p0) => p0.name.toString() == "result")
.value;
List<XmlElement> readerElementList =
document.rootElement.findAllElements("readerData").toList();
List<ReaderData> readerDataList = readerElementList
.map((e) => ReaderData.fromXML(e.toXmlString()))
.toList();
return ReaderReadResponse(
messageName: messageName,
messageID: int.parse(messageID),
result: result,
dataList: readerDataList,
);
}