If your string doesn't contain the namespaces then you can use the following piece of code:
string xmlFrag ="<book> " +
"<title>Pride And Prejudice</title>" +
"<genre>novel</genre>" +
"</book>";
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlFrag);
doc.Save("myfile.xml"

;
}
catch (Exception ex)
{
string sMsg = ex.GetType() + ex.Message;
throw new Exception (ex);
}
If your string contains namespaces then use XmlTextReader:
XmlParserContext context = new XmlParserContext(...);
XmlTextReader reader = new XmlTextReader(xmlFrag, XmlNodeType.Element, context);
-obislavu-