如何将 CSS 样式表添加到 WCF 生成的 RSS 源?
我有一个 WCF 服务,它使用 System.ServiceModel.Synmination.SynminationFeed 创建 RSS 源。
但我无法弄清楚如何添加处理指令来输出指向我的 CSS 样式表。
我需要的是一个看起来有点像这样的处理指令:
<?xml-stylesheet type="text/css" href="http://you.com/rss.css" ?>
有人知道如何使用 SyndicateFeed 添加它吗?
I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.
But I'm having trouble figuring out how to add a Processing Instruction to output that points to my CSS stylesheet.
What I need is a processing instruction that looks a bit like this:
<?xml-stylesheet type="text/css" href="http://you.com/rss.css" ?>
Anyone have a hint how you add that using SyndicationFeed ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不熟悉WCF,但我发现这个< /a>. 我想这可能对你有帮助。
http://www.developmentnow.com/g/ 8_2008_2_0_0_1041398/xslt-and-System-ServiceModel-Syndicate.htm
I am not familiar with WCF, but I found this. I think this might help you out.
http://www.developmentnow.com/g/8_2008_2_0_0_1041398/xslt-and-System-ServiceModel-Syndication.htm
由于您的合约将返回 SyndicateFeedFormatter 的实例(该实例实现 IXmlSerialized),因此我会让服务合约上的方法获取该实例,然后调用 IXmlSerialized 上的方法将输出序列化为 XML。 然后,您可以将处理指令添加到 XML(XDocument 或 XmlDocument)中,然后将这些内容传回。
Since your contract is going to return an instance of SyndicationFeedFormatter, which implements IXmlSerializable, I would have your method on the service contract get that instance, then call the methods on IXmlSerializable to serialize the output to XML. You can then add the processing instruction to the XML (XDocument, or XmlDocument) and then pass those contents back.