TryReadElementFromXml method
Tries to read element from XML.
The reader.
Implementation
@override
Future<bool> TryReadElementFromXml(EwsServiceXmlReader reader) async {
switch (reader.LocalName) {
case XmlElementNames.Date:
// The date that is returned by Availability is unscoped.
DateTime tempDate = DateTime.parse(
(await reader.ReadElementValue<String>())!.trim(),
);
// DateTime.Parse converts a biased value (with "Z" or an offset) to
// local time and the kind is then dropped (unspecified); a local Dart
// DateTime carries the same wall-clock components.
_date = tempDate.isUtc ? tempDate.toLocal() : tempDate;
return true;
case XmlElementNames.DayQuality:
_quality = await reader.ReadElementValue<SuggestionQuality>();
return true;
case XmlElementNames.SuggestionArray:
if (!reader.IsEmptyElement) {
do {
await reader.Read();
if (reader.IsStartElementWithNamespace(
XmlNamespace.Types,
XmlElementNames.Suggestion,
)) {
TimeSuggestion timeSuggestion = TimeSuggestion();
await timeSuggestion.LoadFromXml(reader, reader.LocalName);
_timeSuggestions.add(timeSuggestion);
}
} while (!reader.IsEndElementWithNamespace(
XmlNamespace.Types,
XmlElementNames.SuggestionArray,
));
}
return true;
default:
return false;
}
}