In my c# application i am creating an xml based on the database value. It woks fine until the string is not a special character. Below is my code.
XmlDocument doc = new XmlDocument();
XmlElement element = doc.CreateElement("NewDataSet");
------
string itemname =System.Web.HttpUtility.HtmlEncode(ds.Tables[0].Rows[j]["itemname"].ToString());
fieldElement = doc.CreateElement(itemname);
fieldElement.InnerText = ds.Tables[0].Rows[j]["count"].ToString();
fieldElement1.AppendChild(fieldElement);
where i am getting error in `fieldElement = doc.CreateElement(itemname); as The ' ' character, hexadecimal value 0x20, cannot be included in a name. And the string which throws exception is "Adam & Eva frisør".
Can anyone tell me how to overcome this problem.