c# - Creating XML file header -


I want to create XML file with dynamic title open

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Urlset xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schema location = "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;  

How do I create this urlset node?

with 3.5, something like:

  XNamespace ns = " Http://www.sitemaps.org/schemas/sitemap/0.9 "; X-namespace xsi = "http://www.w3.org/2001/XMLSchema-instance"; XDocument Document = New XDocument (New XDeclaration ("1.0", "utf-8", Faucet), New XElement (ns + "urlset", New XAttribute (XNamespace.Xmlns + "xsi", xsi), New XAttribute (xsi + "Schema Location", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"), New XElement (ns + "url "))); // save / writeeto string s = doc.ToString ();  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -