但如果我使用IE加载相同的页面
我尝试在加载的IHTMLdocument2中注入一个CSS,正如在这个问题CSS and TWebbrowser delphi中所建议的那样,但我仍然得到相同的结果.
问题是,如何在TWebbrowser中加载RSS Feed但是将输出显示为像IE这样的HTML文档呢?
解决方法 只是猜测,但您可以尝试应用以下XSL样式表(取自 http://snippets.dzone.com/posts/show/1162并按照以下评论中的cherdt的建议进行修改):<xsl:stylesheet version="1.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xsl="http://www.w3.org/1999/XSL/transform" xmlns:dc="http://purl.org/dc/elements/1.1/"> <xsl:output method="HTML"/> <xsl:template match="/"> <xsl:apply-templates select="/atom:Feed/atom:head"/> <xsl:apply-templates select="/atom:Feed"/> </xsl:template> <xsl:template match="atom:Feed/atom:head"> <h3><xsl:value-of select="atom:Title"/></h3> <xsl:if test="atom:tagline"><p><xsl:value-of select="atom:tagline"/></p></xsl:if> <xsl:if test="atom:subTitle"><p><xsl:value-of select="atom:subTitle"/></p></xsl:if> </xsl:template> <xsl:template match="/atom:Feed"> <h3><xsl:value-of select="atom:Title"/></h3> <xsl:if test="atom:tagline"><p><xsl:value-of select="atom:tagline"/></p></xsl:if> <xsl:if test="atom:subTitle"><p><xsl:value-of select="atom:subTitle"/></p></xsl:if> <ul> <xsl:apply-templates select="atom:entry"/> </ul> </xsl:template> <xsl:template match="atom:entry"> <li> <a href="{atom:link[@rel='related']/@href}" title="{substring(atom:published,11)}"><xsl:value-of select="atom:Title"/></a> <xsl:choose> <xsl:when test="atom:content != ''"> <p><xsl:value-of select="atom:content" disable-output-escaPing="yes" /></p> </xsl:when> <xsl:otherwise> <p><xsl:value-of select="atom:summary" disable-output-escaPing="yes" /></p> </xsl:otherwise> </xsl:choose> </li> </xsl:template></xsl:stylesheet>
到你收到的饲料.要转换文档,请参阅this question’s selected answer,然后您可以尝试将生成的XML分配给Webbrowser.
我猜你将Webbrowser控件指向Feed,但是使用这种方法你需要使用例如Indy(检查TIDhttp及其Get()方法)下载Feed,转换它,然后显示在你的控制.
请注意,以上只是一个猜测,但我相信这是一个很好的假设. 总结
以上是内存溢出为你收集整理的我如何在TWebBrowser中以HTML格式显示rss feed的输出?全部内容,希望文章能够帮你解决我如何在TWebBrowser中以HTML格式显示rss feed的输出?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)