LoadFromXml method

void LoadFromXml(
  1. EwsServiceXmlReader reader
)
Loads from XML. The reader.

Implementation

void LoadFromXml(EwsServiceXmlReader reader) {
  reader.ReadStartElementWithNamespace(
      XmlNamespace.Messages, XmlElementNames.Notification);

  do {
    NotificationGroup notifications = new NotificationGroup();
    notifications.SubscriptionId = reader.ReadElementValueWithNamespace(
        XmlNamespace.Types, XmlElementNames.SubscriptionId);
    notifications.Events = <NotificationEvent>[];

    this.events.add(notifications);

    do {
      reader.Read();

      if (reader.IsStartElement()) {
        String eventElementName = reader.LocalName;

        if (GetEventsResults.XmlElementNameToEventTypeMap!.containsKey(
            eventElementName)) {
          EventType? eventType =
              GetEventsResults.XmlElementNameToEventTypeMap![eventElementName];
          if (eventType == EventType.Status) {
            // We don't need to return status events
            reader.ReadEndElementIfNecessary(
                XmlNamespace.Types, eventElementName);
          } else {
            this.LoadNotificationEventFromXml(
                reader, eventElementName, eventType, notifications);
          }
        } else {
          reader.SkipCurrentElement();
        }
      }
    } while (!reader.IsEndElementWithNamespace(
        XmlNamespace.Messages, XmlElementNames.Notification));

    reader.Read();
  } while (!reader.IsEndElementWithNamespace(
      XmlNamespace.Messages, XmlElementNames.Notifications));
}