public static string xmlServiceType()
{
string path;
path = Convert.ToString(HttpContext.Current.Server.MapPat h("~/App_Data/xml1.xml"));
return path;
}
// convert string into xml
public static string getReportBackUp(string MailID)
{
XmlDocument doc = new XmlDocument();
doc.Load(xmlServiceType());
XmlElement newElem = doc.CreateElement("Mail");
XmlAttribute MailTo = doc.CreateAttribute("MailTo");
MailTo.Value = MailID;
newElem.Attributes.Append(MailTo);
// doc.DocumentElement.AppendChild(newElem);
doc.DocumentElement.AppendChild(newElem);
string s = Convert.ToString(MailID);
doc.Save(xmlServiceType());
//string s = newElem.ToString();
return s;
}
This code is in c# which convert String to XML & write it in xml file & database.
I am fired string from TextBox. But in XML file multiple Email ID come at single line
I want 1 Email ID at 1 Line next at next line if nos od Email ID is fired
plese send me code if any one know
my xml look like this
<Mail MailTo="
[email protected],prafullaborade@rediff mail.com" />
<Mail MailTo="
[email protected],prafullaborade@rediff mail.com" />
<Mail MailTo="
[email protected],
[email protected] om" />
i want it in this format
<Mail MailTO="
[email protected]"/>
<<Mail MailTo="
[email protected]" />
even if nos of Email ID is fired at a time from textbox