日期:2014-05-18 浏览次数:20730 次
string a = "1.jpg"; string b = "第一张图"; string c = "http://www.sina.com.cn/ETicket/Index.aspx?id=100&type=0"; StringBuilder sb = new StringBuilder(); sb.Append("<item item_url='../Advertisment/Image/" + a + "' itemtitle='" + b + "' link='" + c + "' />"); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml("<?xml version='1.0' encoding='gb2312'?>" + "<bcaster>" + sb.ToString() + "</bcaster>"); xmlDoc.Save(@"C:\data.xml");
string a = "1.jpg"; string b = "第一张图"; string c = "http://www.sina.com.cn/ETicket/Index.aspx?id=100&type=0"; StringBuilder sb = new StringBuilder(); sb.Append("<item item_url='../Advertisment/Image/" + a + "' itemtitle='" + b + "' link='" + c + "' />"); XmlDocument xmlDoc = new XmlDocument(); string s = "<?xml version='1.0' encoding='gb2312'?>" + "<bcaster>" + sb.ToString() + "</bcaster>"; xmlDoc.LoadXml(s); xmlDoc.Save(@"C:\data.xml");
------解决方案--------------------
string c = "http://www.sina.com.cn/ETicket/Index.aspx?id=100&type=0";
中含有等号,考虑一下转义