private IComment ReadComment(XmlReader xmlReader) { var user = string.Empty; var version = string.Empty; var date = DateTime.MinValue; var severity = Severity.Undefined; var text = string.Empty; var index = 0; while (xmlReader.Read()) { switch (xmlReader.NodeType) { case XmlNodeType.Element: if (index == 0 && string.Compare(xmlReader.Name, NsPrefix + ":comment", StringComparison.OrdinalIgnoreCase) == 0) { index++; while (xmlReader.MoveToNextAttribute()) { if (string.Compare(xmlReader.Name, "user", StringComparison.OrdinalIgnoreCase) == 0) { user = xmlReader.Value; } if (string.Compare(xmlReader.Name, "version", StringComparison.OrdinalIgnoreCase) == 0) { version = xmlReader.Value; } if (string.Compare(xmlReader.Name, "date", StringComparison.OrdinalIgnoreCase) == 0) { var format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'"; var success = DateTime.TryParseExact(xmlReader.Value, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateValue); date = success ? dateValue : DateTime.MinValue; } if (string.Compare(xmlReader.Name, "severity", StringComparison.OrdinalIgnoreCase) == 0) { var success = Enum.TryParse <Severity>(xmlReader.Value, true, out var value); severity = success ? value : Severity.Undefined; } } } break; case XmlNodeType.Whitespace: text += xmlReader.Value; break; case XmlNodeType.Text: text += xmlReader.Value; break; case XmlNodeType.CDATA: text += xmlReader.Value; break; case XmlNodeType.EntityReference: text += xmlReader.Name; break; } } var comment = _segmentBuilder.CreateComment(text, user, severity, date, version); return(comment); }