title: SQL Server FOR XML PATH namespace declaration on root element
body: <p>I'm using a FOR XML PATH query to generate a sitemap from our database and I need to declare a namespace that has a different name than the default:</p>
  
  <p>(see xsi:schemaLocation below)</p>
  
  <pre><code>&lt;urlset
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        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"&gt;
  </code></pre>
  
  <p>How can this be done using :</p>
  
  <pre><code>;with xmlnamespaces( default 'http://www.sitemaps.org/schemas/sitemap/0.9',
                  'http://www.w3.org/2001/XMLSchema-instance' as xsi,
                  'http://www.sitemaps.org/schemas/sitemap/0.9
          http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd' --as "xsi:schemaLocation"
  </code></pre>
  
  <p>Thank you!</p>