Parse static method

Future<SoapFaultDetails> Parse(
  1. EwsXmlReader reader,
  2. XmlNamespace soapNamespace
)
Parses the soap:Fault content. The reader. The SOAP namespace to use.

Implementation

static Future<SoapFaultDetails> Parse(
    EwsXmlReader reader, XmlNamespace soapNamespace) async {
  SoapFaultDetails soapFaultDetails = new SoapFaultDetails();

  do {
    await reader.Read();
    if (reader.NodeType == XmlNodeType.Element) {
      switch (reader.LocalName) {
        case XmlElementNames.SOAPFaultCodeElementName:
          soapFaultDetails.FaultCode =
              await reader.ReadElementValue<String>();
          break;

        case XmlElementNames.SOAPFaultStringElementName:
          soapFaultDetails.FaultString =
              await reader.ReadElementValue<String>();
          break;

        case XmlElementNames.SOAPFaultActorElementName:
          soapFaultDetails.FaultActor =
              await reader.ReadElementValue<String>();
          break;

        case XmlElementNames.SOAPDetailElementName:
          await soapFaultDetails.ParseDetailNode(reader);
          break;

        default:
          break;
      }
    }
  } while (!reader.IsEndElementWithNamespace(
      soapNamespace, XmlElementNames.SOAPFaultElementName));

  return soapFaultDetails;
}