private static void XMLPHOTO(string xmlFilePath,string imgURLVal, string linkURLVal, string titleVal, string descVal )
{
XmlDocument XD = new XmlDocument();
XD.Load(xmlFilePath);
XmlNode Root = XD.SelectSingleNode("//Photos");
XmlNode Photo = Root.AppendChild(XD.CreateElement("Photo"));
XmlAttribute PhotAtr1 = Photo.Attributes.Append(XD.CreateAttribute("imageurl"));
PhotAtr1.InnerText = imgURLVal;
XmlAttribute PhotAtr2 = Photo.Attributes.Append(XD.CreateAttribute("linkurl"));
PhotAtr2.InnerText = linkURLVal;
XmlNode title = Photo.AppendChild(XD.CreateElement("Title"));
title.InnerText = titleVal;
XmlNode desc = Photo.AppendChild(XD.CreateElement("Description"));
desc.InnerText = descVal;
XD.Save(xmlFilePath);
}
Use this code...
it does what exactly you want. Make sure you dont get error at
XD.Load