XML写入不了问题,
请各位大大帮我看下,下面写入XML的代码那里有问题:--------------------编程问答-------------------- tiltviewergallery.AppendChild(photos); --------------------编程问答-------------------- 报什么错误?
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("gallery.xml"));
XmlNode tiltviewergallery = xmlDoc.SelectSingleNode("tiltviewergallery");
XmlElement photos = xmlDoc.CreateElement("photos");
XmlElement photo = xmlDoc.CreateElement("photo");
photo.SetAttribute("imageurl", "images/img_01.jpg");
photo.SetAttribute("linkurl", "http://www.baidu.com");
XmlElement title = xmlDoc.CreateElement("title");
title.InnerText = "Image 1";
XmlElement description = xmlDoc.CreateElement("description");
description.InnerText = "This is a regular text description.";
photos.AppendChild(title);
photos.AppendChild(description);
photos.AppendChild(photo);
xmlDoc.Save(Server.MapPath("gallery.xml"));
--------------------
深圳公交车群:28195594
欢迎深圳挤公交的程序员加入!
补充:.NET技术 , ASP.NET