2

I'm adding some custom iTunes podcast tags to a RSS Feed.

        feed.AttributeExtensions.Add(new XmlQualifiedName(itunesPrefix, 
            "http://www.w3.org/2000/xmlns/"), itunesNs);

        var extensions = feed.ElementExtensions;

        extensions.Add(new SyndicationElementExtension("category", itunesNs, "Business"));

        var categoryElem = XName.Get("category", itunesNs);

        extensions.Add(
            new XElement(categoryElem,
                new XAttribute("text", "Sports & Recreation"),
                    new XElement(categoryElem,
                        new XAttribute("text", "Amateur")
                    )
            ).CreateReader()
        );

The output is:

<itunes:category>Business</itunes:category>
<category text="Sports &amp;amp; Recreation" xmlns="http://www.itunes.com/dtds/podcast-1.0.dtd">
  <category text="Amateur">
  </category>
</category>

Why is it that SyndicationElementExtension correctly adds the namespace prefix "itunes" but passing an XmlReader instance does not?

The output I expected is:

<itunes:category text="Sports &amp;amp; Recreation">
  <itunes:category text="Amateur">
  </itunes:category>
</itunes:category>
Ben Foster
  • 34,340
  • 40
  • 176
  • 285

1 Answers1

0

You know what I found the easiest to do was to just create it normally and then use Feedburner to submit it to iTunes and make iTunes compatible.

Jamie R Rytlewski
  • 1,172
  • 9
  • 22