UpdateFromXmlWithNamespace method

  1. @override
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
void UpdateFromXmlWithNamespace(EwsServiceXmlReader reader,
    XmlNamespace xmlNamespace, String xmlElementName) {
  reader.EnsureCurrentNodeIsStartElementWithNamespace(
      xmlNamespace, xmlElementName);

  if (!reader.IsEmptyElement) {
    int index = 0;
    do {
      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");
//                        }

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