all things Sitecore related

XML

Linq to Xml: Generate Google Sitemap with sitemap-protocol

By on July 8, 2009 in ASP.Net, Google, linq, XML with 1 Comment

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 […]

Continue Reading »

Convert XmlElement to XElement (Extension Method)

By on December 8, 2008 in linq, XML with 5 Comments

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, […]

Continue Reading »

Top