           using (var stringWriter = new StringWriter())                        {                             using (var xmlTextWriter = XmlWriter.Create(stringWriter))                             {                                 doc.WriteTo(xmlTextWriter);              