public void AddSegment([NotNull] XmlNode componentNode) { Assert.ArgumentNotNull(componentNode, "componentNode"); var segmentElement = (XmlElement)componentNode; var rootString = segmentElement.GetAttribute("root"); Assert.IsNotNull(rootString, "root attribute is not specified or has empty string value: " + segmentElement.OuterXml); ID root; Assert.IsTrue(ID.TryParse(rootString, out root), "root attribute is not a valid GUID value: " + segmentElement.OuterXml); var file = segmentElement.GetAttribute("file"); Assert.IsNotNullOrEmpty(file, "file attribute is not specified or has empty string value: " + segmentElement.OuterXml); var filePath = MainUtil.MapPath(file); var segment = new JsonSegment(root, filePath); this.Segments.Add(segment); }