我正在尝试创建一个 php 梦幻足球应用程序,它使用现有的 rss 提要来更新大学项目的数据库。我的问题是我能找到的唯一免费 rss 提要的格式不允许我简单地使用 xslt 删除信息并正确显示它。
这是来自提要的简短摘录:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Soccer Livescore RSS Feed - ScoresPro.com</title>
<ttl>2</ttl>
<link>http://www.scorespro.com</link>
<description>Latest scores from ScoresPro.com</description>
<pubDate></pubDate>
<item>
<title>Pst AL Wahda FC Abu Dhabi - AL Ahli Dubai 0 - 0 (UAE - Premier League) </title>
<link>http://www.scorespro.com/</link></item>
<item>
<title>Pst Dubai Csc - AL Wasl Dubai 0 - 0 (UAE - Premier League) </title>
<link>http://www.scorespro.com/</link>
</item>
<item>
<title>Pst Ittihad - Wathbah 0 - 0 (SYRIA - Division 1) </title>
<link>http://www.scorespro.com/</link>
</item>
<item>
<title>Pst Saba - Sepahan 0 - 0 (IRAN - Premier League) </title>
<link>http://www.scorespro.com/</link>
</item>
<item>
<title>HT Teshrin - Foutoua 1 - 0 (SYRIA - Division 1) </title>
<link>http://www.scorespro.com/</link>
</item>
</channel>
</rss>
有什么方法可以使用 PHP 或 Xslt 提取单个标签的各个部分,以便在将其插入数据库时将标题分为主队、客队、比分?
如有任何帮助,我将不胜感激,以便我可以开始规划该项目?
最佳答案
int xml_parse ( resource $parser , string $data [, bool $is_final = false ] )
此扩展允许您创建 XML 解析器,然后为不同的 XML 事件定义处理程序。每个 XML 解析器还有一些您可以调整的参数。
关于php - 有什么方法可以使用 PHP 或 Xslt 提取单个 XML 标记的各个部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4106704/