UpdateFromXmlWithNamespace method

  1. @override
Future<void> UpdateFromXmlWithNamespace(
  1. EwsServiceXmlReader reader,
  2. XmlNamespace xmlNamespace,
  3. String xmlElementName
)
override
Loads from XML to update itself. The reader. The XML namespace. Name of the XML element.

Implementation

@override
Future<void> UpdateFromXmlWithNamespace(EwsServiceXmlReader reader,
    XmlNamespace xmlNamespace, String xmlElementName) async {
  reader.EnsureCurrentNodeIsStartElementWithNamespace(
      xmlNamespace, xmlElementName);

  if (!reader.IsEmptyElement) {
    int index = 0;
    do {
      await reader.Read();

      if (reader.IsStartElement()) {
        TComplexProperty? complexProperty =
            this.CreateComplexProperty(reader.LocalName);
        TComplexProperty actualComplexProperty = this[index++];

        // todo("implement check")
//                        if (complexProperty == null || !complexProperty.GetType().IsInstanceOfType(actualComplexProperty))
//                        {
//                            throw new ServiceLocalException("Strings.PropertyTypeIncompatibleWhenUpdatingCollection");
//                        }

        await actualComplexProperty.UpdateFromXmlWithNamespace(
            reader, xmlNamespace, reader.LocalName);
      }
    } while (!reader.IsEndElementWithNamespace(xmlNamespace, xmlElementName));
  }
}