Tag: Web之頁面處理-內容填充

  • Web之頁面處理-內容填充

    XmlDocument xDoc = new XmlDocument();         try         {             xDoc.Load(“xml文件路徑”);             XmlNode xNode = xDoc.SelectSingleNode(“xpath語法”);             if (xNode != null)             {                 xNode.InnerText = “秋色園:cyqdata”;//用戶名填充                 if (xNode.Attributes[“href”] == null)//用戶名鏈接填充                 {                     XmlAttribute attr = xDoc.CreateAttribute(“href”);                     xNode.Attributes.Append(attr);                 }                 xNode.Attributes[“href”].Value = “http://www.cyqdata.com/“;             }         } 使勁想啊:壹個節點填充,需要寫這麽長的代碼,開發起來那得是何等相當的吃力?對於Xml操作賦值,還需要考慮使用:<![CDATA[帶特殊字符的內容]]>,來解析復雜內容。