title: How to generate xsi:schemalocation attribute correctly when generating a dynamic sitemap.xml with LINQ to XML?
body: <p>I am generating a dynamic sitemap.xml</p>
  
  <p>According to <a href="http://www.sitemaps.org/protocol.php" rel="nofollow noreferrer">sitemaps.org</a> this is the header for a sitemap.xml</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
       xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"&gt;
      &lt;url&gt;
      ...
      &lt;/url&gt;
  &lt;/urlset&gt;
  </code></pre>
  
  <p>So I'm using LINQ To XML to generate the sitemap.xml</p>
  
  <pre><code>XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9";
  return new XElement(ns + "urlset",
      new XAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9"),
      new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
      //new XAttribute("xsi:schemaLocation", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"),
      from node in new GetNodes()
      select new XElement(ns + "url",
          new XElement(ns + "loc", node.Loc),
          new XElement(ns + "lastmod", node.LastMod),
          new XElement(ns + "priority", node.Priority)
      )
  ).ToString();
  </code></pre>
  
  <p>The commented line is the one i cannot get right.<br>
  How can i set the "xsi:schemalocation" attribute?</p>
  
  <p>Thanks.</p>