5
मैं तो जैसे निम्न XML उत्पन्न की जरूरत है:एक XElement के साथ और नाम के बिना नामस्थान जोड़े
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<url>
<loc>http://www.xyz.eu/</loc>
<lastmod>2010-01-20T10:56:47Z</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>
<url>
<loc>http://www.xyz.eu/2/</loc>
<lastmod>2009-10-13T10:20:03Z</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.xyz.eu/3/</loc>
<lastmod>2009-10-13T10:19:09Z</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>
</urlset>
मैं नहीं कर सकते डाले बिना कोई नाम के साथ नाम स्थान को जोड़ने का तरीका पता लगाने के लिए लग रहे हैं 'xmlns = ""' सभी यूआरएल टैग में।
मेरी कोड:
XNamespace blank = XNamespace.Get(@"http://www.sitemaps.org/schemas/sitemap/0.9");
XNamespace xsi = XNamespace.Get(@"http://www.w3.org/2001/XMLSchema-instance");
XDocument doc = new XDocument(
new XDeclaration("1.0", "utf-8", "yes"),
new XElement(blank + "urlset",
//new XAttribute(XNamespace.Xmlns +"", blank),
new XAttribute(XNamespace.Xmlns + "xsi", xsi),
// This private method loops through the dictionary and creates all the page nodes
GetSiteMapChildren(pageIdVersionDic, site.Url)
));
कोई भी विचार? धन्यवाद
आप कैसे लूप करते हैं? – Mithil
क्षमा करें - मुझे समझ में नहीं आता कि आपका क्या मतलब है ... –
आपका उदाहरण केवल एक ..... जोड़ता है। मैं एकाधिक कैसे जोड़ूं? –
Mithil