title: how to add <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> in only first note
body: <p>i want create sitemap.xml for google when i use &quot;ns+&quot; XNamespace insert to all nodes and output is under xml code xmlns=&quot;&quot; is missing, how to create,please help me about create sitemap with asp.net and c# without 
  i use foreach to read all news data and create url nodes dynamicaly</p>
  <pre><code>&lt;urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&gt;
    &lt;url xmlns=&quot;&quot;&gt;
      &lt;loc&gt;https://test.com/&lt;/loc&gt;
      &lt;lastmod&gt;2022-05-21&lt;/lastmod&gt;
      &lt;priority&gt;1.0&lt;/priority&gt;
    &lt;/url&gt;
  &lt;/urlset&gt;
  
  </code></pre>
  <pre><code>XNamespace ns = &quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;;
  
              XDocument xDoc = new XDocument();
  
              var element = new XElement(ns + &quot;urlset&quot;);
  
              element.Add(new XElement(&quot;url&quot;,
  
                    //Root Element
                    new XElement(&quot;loc&quot;, &quot;https://test.com/&quot;),
                    new XElement(&quot;lastmod&quot;, String.Format(&quot;{0:yyyy-MM-dd}&quot;, DateTime.Now)),
                    new XElement(&quot;priority&quot;, &quot;1.0&quot;))
  
                );
  
              element.Add(new XElement(&quot;url&quot;,
  
                   //Root Element
                   new XElement(&quot;loc&quot;, &quot;https://test.com/NewsList.aspx&quot;),
                   new XElement(&quot;lastmod&quot;, String.Format(&quot;{0:yyyy-MM-dd}&quot;, DateTime.Now)),
                   new XElement(&quot;priority&quot;, &quot;1.0&quot;))
  
               );
  
              element.Add(new XElement(&quot;url&quot;,
  
                   //Root Element
                   new XElement(&quot;loc&quot;, &quot;https://test.com/NewsList.aspx?pn=0&quot;),
                   new XElement(&quot;lastmod&quot;, String.Format(&quot;{0:yyyy-MM-dd}&quot;, DateTime.Now)),
                   new XElement(&quot;priority&quot;, &quot;1.0&quot;))
  
               );
  
              foreach (var item in newsIds)
              {
                  element.Add(new XElement(&quot;url&quot;,
  
                     //Root Element
                     new XElement(&quot;loc&quot;, &quot;https://test.com/news.aspx?id=&quot; + item),
                     new XElement(&quot;lastmod&quot;, String.Format(&quot;{0:yyyy-MM-dd}&quot;, DateTime.Now)),
                     new XElement(&quot;priority&quot;, &quot;1.0&quot;))
  
                 );
              }
  
  
  
              xDoc.Add(element);
  
              xDoc.Save(HttpContext.Current.Server.MapPath(&quot;~&quot;) + &quot;sitemap.xml&quot;);
  
  </code></pre>