In this example I will generate a XML site-map that complies with the sitemap-protocol XML schema. //create datasource List<string> blogPosts = new List<string>{  "http://blog.newguid.net/mypost1.aspx",  "http://blog.newguid.net/mypost_about_Net.aspx",  "http://blog.newguid.net/morePosts.aspx",  "http://blog.newguid.net/andEvenMorePosts.aspx" }; //Create namespace for sitemap-protocol XNamespace xmlNS = "http://www.sitemaps.org/schemas/sitemap/0.9"; XDocument xmlDoc =  new XDocument(   new XDeclaration("1.0", "UTF-8", null),   new XElement(xmlNS + "urlset",    from blogPostUrl in blogPosts    select     new XElement(xmlNS + "url",     new XElement(xmlNS + "loc", blogPostUrl))     )); //Show output Response.Write(xmlDoc); This example will give the following output: <urlset More Info »

I was using some web-services that returned there values in an XmlElement. I needed to convert this XmlElement to something that I can use with LINQ. I didn't find good solutions on the internet. So I started building my own convert logic. After all kinds of solutions I ended up with creating an new XmlDocument, adding the XmlElement to the XmlDocument and then convert the innerXml of the XmlDocument to an XElement. Not really nice but it does the trick. I've rewritten More Info »