If you have problem with the code while inserting DOCTYPE element in XmlDocument then it will be better to share your code with us to help you in better way.
If you don't know how to add DOCTYPE Element in XmlDocument then refer the below sample code :
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
var stringwriter = new System.IO.StringWriter();
using (XmlWriter writer = XmlWriter.Create(stringwriter))
writer.WriteDocType("service or class name", "string value", "string value", null);
var serializer = new XmlSerializer(typeof(myService)); // type of can be anything like class, service, dataset, etc.
serializer.Serialize(writer, obj, ns); // obj can be anything like object of class or service
var str = stringwriter.ToString();
Hope this will be helpful for you.
DNS Gold Member
"Failure is the path of least persistence"