Message.fromXml constructor

Message.fromXml(
  1. XmlElement elem
)

Implementation

factory Message.fromXml(_s.XmlElement elem) {
  return Message(
    attributes: Map.fromEntries(
      elem.findElements('Attribute').map(
            (c) => MapEntry(
              _s
                  .extractXmlStringValue(c, 'Name')!
                  .toMessageSystemAttributeName(),
              _s.extractXmlStringValue(c, 'Value')!,
            ),
          ),
    ),
    body: _s.extractXmlStringValue(elem, 'Body'),
    mD5OfBody: _s.extractXmlStringValue(elem, 'MD5OfBody'),
    mD5OfMessageAttributes:
        _s.extractXmlStringValue(elem, 'MD5OfMessageAttributes'),
    messageAttributes: Map.fromEntries(
      elem.findElements('MessageAttribute').map(
            (c) => MapEntry(
              _s.extractXmlStringValue(c, 'Name')!,
              MessageAttributeValue.fromXml(_s.extractXmlChild(c, 'Value')!),
            ),
          ),
    ),
    messageId: _s.extractXmlStringValue(elem, 'MessageId'),
    receiptHandle: _s.extractXmlStringValue(elem, 'ReceiptHandle'),
  );
}