private void ImportKVA(string source, bool isFile) { XmlReader reader = null; try { bool relativeTrajectories; string kva = MetadataConverter.Convert(source, isFile, out relativeTrajectories); XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true; settings.IgnoreProcessingInstructions = true; settings.IgnoreWhitespace = true; settings.CloseInput = true; reader = isFile ? XmlReader.Create(kva, settings) : XmlReader.Create(new StringReader(kva), settings); Load(reader); if (relativeTrajectories) { metadata.FixRelativeTrajectories(); } } catch (Exception e) { log.Error("An error happened during the parsing of the KVA metadata"); log.Error(e); } finally { if (reader != null) { reader.Close(); } } }