复制代码 代码如下:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<xml>" + s + "</xml>");
xmlDoc.SelectSingleNode(@"//b4").InnerText = "修改后的b4";
Response.Write(Server.HtmlEncode(xmlDoc.DocumentElement.InnerXml));
复制代码 代码如下:
string s = @"<a1>a1的值</a1><a2>a2的值</a2><a3>a3的值</a3><a4><b4>b4的值</b4></a4>";
HtmlDocument hxmlDoc = new HtmlDocument();
hxmlDoc.LoadHtml(s);
hxmlDoc.DocumentNode.SelectSingleNode(@"//b4").InnerHtml = "修改后的b4";
Response.Write(Server.HtmlEncode(hxmlDoc.DocumentNode.InnerHtml));
新闻热点
疑难解答
图片精选