当前位置:编程学习 > C#/ASP.NET >>

XML写入不了问题,

请各位大大帮我看下,下面写入XML的代码那里有问题:

        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"));
--------------------编程问答-------------------- tiltviewergallery.AppendChild(photos); --------------------编程问答-------------------- 报什么错误?


--------------------
深圳公交车群:28195594
欢迎深圳挤公交的程序员加入!
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,