Parse static method

Parses the XML through the specified reader and creates an Autodiscover error. The reader.

Implementation

static Future<AutodiscoverError> Parse(EwsXmlReader reader) async {
  AutodiscoverError error = new AutodiscoverError._();

  error._time = reader.ReadAttributeValue(XmlAttributeNames.Time);
  error._id = reader.ReadAttributeValue(XmlAttributeNames.Id);

  do {
    await reader.Read();

    if (reader.NodeType == XmlNodeType.Element) {
      switch (reader.LocalName) {
        case XmlElementNames.ErrorCode:
          error._errorCode = await reader.ReadElementValue<int>();
          break;
        case XmlElementNames.Message:
          error._message = await reader.ReadElementValue<String>();
          break;
        case XmlElementNames.DebugData:
          error._debugData = await reader.ReadElementValue<String>();
          break;
        default:
          await reader.SkipCurrentElement();
          break;
      }
    }
  } while (!reader.IsEndElementWithNamespace(
      XmlNamespace.NotSpecified, XmlElementNames.Error));

  return error;
}