Read method
Reads the next node.
Implementation
Future<void> Read({XmlNodeType? nodeType}) async {
if (nodeType != XmlNodeType.XmlDeclaration) {
_prevNodeType = _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 _xmlReader.Read();
if (!nodeRead) {
throw ServiceXmlDeserializationException(
"Strings.UnexpectedEndOfXmlDocument",
);
}
if (nodeType != null && NodeType != nodeType) {
throw ServiceXmlDeserializationException("""string.Format(
Strings.UnexpectedElementType,
$nodeType,
$NodeType)""");
}
}