public string CreateCompositionAsXml(Patient patient, Exam exam) { var composition = CreateComposition(patient); var version = CreateVersion(composition); var settings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true, NewLineOnAttributes = true, ConformanceLevel = ConformanceLevel.Auto }; using (var stringWriter = new StringWriter()) { using (var writer = XmlWriter.Create(stringWriter, settings)) { RmXmlSerializer.SerializeEhrServer(writer, version); return(stringWriter.ToString()); } } }