public void Load(XmlDocument Xml, string FileName) { XmlElement E, E2, E3; XSL.Validate(FileName, Xml, logRoot, logNamespace, schema); this.LogListView.Items.Clear(); foreach (XmlNode N in Xml.DocumentElement.ChildNodes) { E = N as XmlElement; if (E is null) { continue; } if (!Enum.TryParse <EventType>(E.LocalName, out EventType Type)) { continue; } DateTime Timestamp = XML.Attribute(E, "timestamp", DateTime.MinValue); EventLevel Level = (EventLevel)XML.Attribute(E, "level", EventLevel.Minor); string EventId = XML.Attribute(E, "id"); string Object = XML.Attribute(E, "object"); string Actor = XML.Attribute(E, "actor"); string Module = XML.Attribute(E, "module"); string Facility = XML.Attribute(E, "facility"); StringBuilder Message = new StringBuilder(); StringBuilder StackTrace = null; List <KeyValuePair <string, object> > Tags = new List <KeyValuePair <string, object> >(); foreach (XmlNode N2 in E.ChildNodes) { E2 = N2 as XmlElement; if (E2 is null) { continue; } switch (E2.LocalName) { case "Message": foreach (XmlNode N3 in E2.ChildNodes) { E3 = N3 as XmlElement; if (E3 is null) { continue; } if (E3.LocalName == "Row") { Message.AppendLine(E3.InnerText); } } break; case "Tag": string Key = XML.Attribute(E2, "key"); string Value = XML.Attribute(E2, "value"); Tags.Add(new KeyValuePair <string, object>(Key, Value)); break; case "StackTrace": if (StackTrace is null) { StackTrace = new StringBuilder(); } foreach (XmlNode N3 in E2.ChildNodes) { E3 = N3 as XmlElement; if (E3 is null) { continue; } if (E3.LocalName == "Row") { StackTrace.AppendLine(E3.InnerText); } } break; } } Event Event = new Event(Timestamp, Type, Message.ToString(), Object, Actor, EventId, Level, Facility, Module, StackTrace?.ToString() ?? string.Empty, Tags.ToArray()); this.Add(new LogItem(Event)); } }