Search code examples
c#rsssyndicationfeedsyndication-item

Why do i have my name space on every SyndicationItem element?


I'm trying to find out why my namespace(xmlns:ren="http://www.example.com/rss2/ext") appears on every custom syndicationItem element (<ren:rssTranslationType typeId="1" xmlns:ren="http://www.example.com/rss2/ext">Original Content</ren:rssTranslationType>) when it's already declared at the top of the file? Bizarrely this only happens after the .rss file has been read into the syndicationFeed > contents updated > then spat back out. Creating a new rss file works fine (no additional name space usages).


Solution

  • This seemed to cure it: XmlWriterSettings settings = new XmlWriterSettings{Indent = true, NamespaceHandling = NamespaceHandling.OmitDuplicates};

     using (XmlWriter xmlWriter = XmlWriter.Create(sourcePath, settings))
                {
                    rssFeedData.SaveAsRss20(xmlWriter);
                }