我有这个字符串,得到一个错误
字符串文本=
<root><Info id="inseID">17</Info><note><123comments></note></root>我想把它转换成
<root><Info id="inseID">17</Info><note><123comments></note></root>发布于 2020-07-16 00:12:33
使用linq to xml。
var text = "<root><Info id=\"inseID\">17</Info><note></note></root>";
var xml = XElement.Parse(text);
xml.Element("note").Add("<123comments>");
//string result = xml.ToString(); // will be escapedhttps://stackoverflow.com/questions/62918515
复制相似问题