【发布时间】:2012-06-30 12:02:23
【问题描述】:
我有一个 iphone 应用程序,它解析标准 rss 提要并将其显示在桌子上。 但是,我从客户端获得了一个提要,但应用程序中的解析器无法获取节点并解析数据,因为它不是标准的 rss 提要。
他们给我的布局如下:
<rss version="0.92">
<channel>
<title>Feed</title>
<link>http://google.com</link>
<description>
Description here
</description>
<lastBuildDate>30 June +0100</lastBuildDate>
<language>en</language>
<event>
<eventID>123</eventID>
<name>Name here</name>
<date>2012-06-29</date>
<time>21:00</time>
<category>Arts</category>
<info>
Info here
</info>
</event>
<event>
<eventID>223</eventID>
<name>Name here</name>
<date>2012-06-30</date>
<time>22:00</time>
<category>Dance</category>
<info>
Info here
</info>
</event>
</channel>
</rss>
有没有办法使用 XSLT 或 PHP 脚本将此 xml 文件重组为标准的 rss 提要布局? 标准的 RSS 提要布局如下:
<rss>
<channel>
<item>
<title>
<![CDATA[ Title here ]]>
</title>
<link>
http://www.theatre.com/
</link>
<guid>
http://www.theatre.com
</guid>
<description>
<p> Description </p>
</description>
<dc:subject>
<![CDATA[ ]]>
</dc:subject>
<dc:date>2013-02-01T18:00:04+00:00</dc:date>
</item>
</channel>
</rss>
【问题讨论】:
-
两者均未验证为 RSS:validator.w3.org/appc/#validate_by_input
-
输出的guid元素内容从何而来?输入中的事件对应于输出中的什么? cd:date 的内容来自哪里?
-
dc 输出的 url 边界是什么?
-
告诉客户端为您提供有效的 RSS v2.0 提要。
-
您的评论与提供的样本无关。能否请您提供: (1) 样本输入文件; (2) 给定输入的预期输出; (三)转化规则; (4) 您使用的是哪个 XSLT 版本:1.0 还是 2.0?
标签: php xml xslt rss atom-feed