How to add an existing Xml string into a XElement?
This code
var doc = new XDocument(
new XElement("results", "<result>...</result>")
);
of course produces this
<results><result></result></results>
but I need this
<results><result>...</result></results>
Any ideas?
This should work:
var xmlString = "<result>sometext</result>";
var xDoc = new XDocument(new XElement("results", XElement.Parse(xmlString)));