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; 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; Recreation">
<itunes:category text="Amateur">
</itunes:category>
</itunes:category>