I am creating an Xml XDocument. When i try to insert a string which contains alphabets, whitespaces, special Characters and numbers. It gives an error at runtime.
The ' ' character, hexadecimal value 0x20, cannot be included in a name.
How can i insert such type of string. Is there any other way to insert this type of string.
Code i am Using:
XDocument xDoc = new XDocument(
                   new XDeclaration("1.0", "UTF-8", "yes"),
                   new XElement("Mail"));
var template = @"To MOM 
            13, AD1
            tr y
            fghdh, Madhya Pradesh, India 
            Dear Ram,
                  We would like to appoint you for new job";
XElement varXElement = new XElement("studentName", template);
xDoc.Element("Mail").Add(varXElement);
xDoc.Save(filePath);