internal static Result FromXElement(XElement resultElement) { Result result = new Result(); //// Import attributes for the implemented interfaces result.ImportISignableItemWithName(resultElement); //// Import the child elements of the current object XElement seriesSetElement = resultElement.Element(NamespaceHelper.GetXName("SeriesSet")); if (seriesSetElement != null) { result.SeriesSet = SeriesSet.FromXElement(seriesSetElement); } result.Categories.AddRange(resultElement.Elements(NamespaceHelper.GetXName("Category")).Select(Category.FromXElement)); XElement experimentStepSetElement = resultElement.Element(NamespaceHelper.GetXName("ExperimentStepSet")); if (experimentStepSetElement != null) { result.ExperimentStepSet = ExperimentStepSet.FromXElement(experimentStepSetElement); } return(result); }
/// <summary> /// Creates a new AnimlDocument from a XDocument. /// </summary> /// <param name="xDoc">A XDocument representing an AnIML file.</param> /// <returns>A new AnimlDocument containing the information loaded from the XDocument.</returns> public static AnimlDocument ReadFromXDocument(XDocument xDoc) { if (xDoc is null) { throw new ArgumentNullException(nameof(xDoc)); } AnimlDocument animlDocument = new AnimlDocument(); XElement animlElement = xDoc.Root; animlDocument.SampleSet = SampleSet.FromXElement(animlElement.Element(NamespaceHelper.GetXName("SampleSet"))); animlDocument.ExperimentStepSet = ExperimentStepSet.FromXElement(animlElement.Element(NamespaceHelper.GetXName("ExperimentStepSet"))); animlDocument.AuditTrailEntrySet = AuditTrailEntrySet.FromXElement(animlElement.Element(NamespaceHelper.GetXName("AuditTrailEntrySet"))); return(animlDocument); }
internal static ExperimentStepSet FromXElement(XElement experimentStepSetElement) { if (experimentStepSetElement is null) { return(null); } ExperimentStepSet experimentStepSet = new ExperimentStepSet(); //// Import attributes for the implemented interfaces experimentStepSet.ImportISignableItem(experimentStepSetElement); //// Import the child elements of the current object experimentStepSet.ExperimentSteps.AddRange(experimentStepSetElement.Elements(NamespaceHelper.GetXName("ExperimentStep")).Select(ExperimentStep.FromXElement)); experimentStepSet.Templates.AddRange(experimentStepSetElement.Elements(NamespaceHelper.GetXName("Template")).Select(Template.FromXElement)); return(experimentStepSet); }