[英]SyndicationFeed AttributeExtensions namespace prefix
I'm adding some custom iTunes podcast tags to a RSS Feed. 我在RSS Feed中添加了一些自定义iTunes podcast标签。
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? 为什么SyndicationElementExtension
正确添加了名称空间前缀“ itunes”,却没有传递XmlReader实例呢?
The output I expected is: 我期望的输出是:
<itunes:category text="Sports &amp; Recreation">
<itunes:category text="Amateur">
</itunes:category>
</itunes:category>
您知道我发现最简单的方法是正常创建它,然后使用Feedburner将其提交到iTunes并使iTunes兼容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.