Reputation: 13
I have this string,and getting an error
string text =
<root><Info id="inseID">17</Info><note><123comments></note></root>
I wanted to convert it to
<root><Info id="inseID">17</Info><note><123comments></note></root>
Upvotes: 0
Views: 165
Reputation: 14231
Use 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 escaped
Upvotes: 1