public XmlElement ToXmlElement (this string xml)
{
XmlDocumentFragment frag = new XmlDocument().CreateDocumentFragment();
frag.InnerXml = xml;
return frag.FirstChild as XmlElement;
}
The problem with this is you have to assume the string you are passing in is well-f0rmed XML.