Read method

Future<void> Read({
  1. XmlNodeType? nodeType = null,
})
Reads the next node.

Implementation

Future<void> Read({XmlNodeType? nodeType = null}) async {
  if (nodeType != XmlNodeType.XmlDeclaration) {
    this._prevNodeType = this._xmlReader.NodeType;
  }

  // XmlReader.Read returns true if the next node was read successfully; false if there
  // are no more nodes to read. The caller to EwsXmlReader.Read expects that there's another node to
  // read. Throw an exception if not true.
  bool nodeRead = await this._xmlReader.Read();
  if (!nodeRead) {
    throw new ServiceXmlDeserializationException(
        "Strings.UnexpectedEndOfXmlDocument");
  }
  if (nodeType != null && this.NodeType != nodeType) {
    throw new ServiceXmlDeserializationException("""string.Format(
                      Strings.UnexpectedElementType,
                      $nodeType,
                      ${this.NodeType})""");
  }
}