Example #1
0
        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);
        }
Example #2
0
        /// <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);
        }