Esempio n. 1
0
        private static DocumentsCollection Load(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }
            XDocument xDoc = null;

            try
            {
                xDoc = XDocument.Load(stream);
            }
            catch (Exception e)
            {
                throw new InvalidFileformatException("Error reading stream", e);
            }

            if (xDoc.Root == null || xDoc.Root.Name != DocumentsCollection.ElementName)
            {
                throw new InvalidFileformatException("Rootelement not found or incorrect");
            }

            var ns = MetadataElement.GetNamespaceFromElement(xDoc.Root);

            var doc = new DocumentsCollection(xDoc.Root, ns);

            return(doc);
        }
Esempio n. 2
0
 internal MetadataFile(ProgramSystemInfo programSystem = null)
 {
     Documents = DocumentsCollection.CreateNew(programSystem);
 }