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); }
internal MetadataFile(ProgramSystemInfo programSystem = null) { Documents = DocumentsCollection.CreateNew(programSystem); }