public MarkupXMLFile(XDocument xdoc) { Comments = new List <BCFComment>(); Viewpoints = new List <BCFViewpoint>(); Header = new BCFHeader(xdoc.Root.Element("Header") ?? new XElement("Header")); Topic = new BCFTopic(xdoc.Root.Element("Topic")); foreach (var comment in xdoc.Root.Elements("Comment") ?? new List <XElement> { new XElement("Comment") }) { if (comment.Element("Topic") == null) { comment.Add(new XElement("Topic", "")); comment.Element("Topic").SetAttributeValue("Guid", Topic.Guid); } if (comment != null) { Comments.Add(new BCFComment(comment)); } } foreach (var v in xdoc.Root.Elements("Viewpoints")) { Viewpoints.Add(new BCFViewpoint(v)); } }
public MarkupXMLFile(XDocument xdoc) { Comments = new List <BCFComment>(); Viewpoints = new List <BCFViewpoint>(); Header = new BCFHeader(xdoc.Root.Element("Header")); Topic = new BCFTopic(xdoc.Root.Element("Topic")); foreach (var comment in (xdoc.Root.Elements("Comment"))) { Comments.Add(new BCFComment(comment)); } foreach (var v in xdoc.Root.Elements("Viewpoints")) { Viewpoints.Add(new BCFViewpoint(v)); } }