TryReadElementFromXml method
Tries to read element from XML.
The reader.
Implementation
@override
Future<bool> TryReadElementFromXml(EwsServiceXmlReader reader) async {
switch (reader.LocalName) {
case XmlElementNames.MeetingTime:
_meetingTime =
await reader.ReadElementValueAsUnbiasedDateTimeScopedToServiceTimeZone();
return true;
case XmlElementNames.IsWorkTime:
_isWorkTime = (await reader.ReadElementValue<bool>()) ?? false;
return true;
case XmlElementNames.SuggestionQuality:
_quality = await reader.ReadElementValue<SuggestionQuality>();
return true;
case XmlElementNames.AttendeeConflictDataArray:
if (!reader.IsEmptyElement) {
do {
await reader.Read();
if (reader.IsStartElement()) {
Conflict? conflict;
switch (reader.LocalName) {
case XmlElementNames.UnknownAttendeeConflictData:
conflict = Conflict(ConflictType.UnknownAttendeeConflict);
break;
case XmlElementNames.TooBigGroupAttendeeConflictData:
conflict = Conflict(ConflictType.GroupTooBigConflict);
break;
case XmlElementNames.IndividualAttendeeConflictData:
conflict = Conflict(ConflictType.IndividualAttendeeConflict);
break;
case XmlElementNames.GroupAttendeeConflictData:
conflict = Conflict(ConflictType.GroupConflict);
break;
default:
EwsUtilities.Assert(
false,
"TimeSuggestion.TryReadElementFromXml",
"The ${reader.LocalName} element name does not map to any AttendeeConflict descendant.",
);
break;
}
if (conflict != null) {
await conflict.LoadFromXml(reader, reader.LocalName);
_conflicts.add(conflict);
} else {
await reader.SkipCurrentElement();
}
}
} while (!reader.IsEndElementWithNamespace(
XmlNamespace.Types,
XmlElementNames.AttendeeConflictDataArray,
));
}
return true;
default:
return false;
}
}