Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new AnimlDocumentValidator from an AnimlDocument
 /// </summary>
 /// <param name="animlDocument">The AnimlDocument to validate against the AnIML core schema.</param>
 /// <returns>A new instance of the AnimlDocumentValidator class for validating AnIML data.</returns>
 public static AnimlDocumentValidator CreateValidatorForAnimlDocument(AnimlDocument animlDocument)
 {
     return(new AnimlDocumentValidator(animlDocument.ToXml()));
 }