我正在尝试使用Python来解析XML文件,以从XML提要中获取标题,作者,URL和摘要.然后我确保我们收集数据的XML是这样的:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:grddl="http://www.w3.org/2003/g/data-view#"
grddl:transformation="2turtle_xslt-1.0.xsl">
<title>Our Site RSS</title>
<link href="http://www.oursite.com" />
<updated>2013-08-14T20:05:08-04:00</updated>
<id>urn:uuid:c60d7202-9a58-46a6-9fca-f804s879f5ebc</id>
<rights>
Original content available for non-commercial use under a Creative
Commons license (Attribution-NonCommercial-NoDerivs 3.0 Unported),
except where noted.
</rights>
<entry>
<title>Headline #1</title>
<author>
<name>John Smith</name>
</author>
<link rel="alternate"
href="http://www.oursite.com/our-slug/" />
<id>1234</id>
<updated>2013-08-13T23:45:43-04:00</updated>
<summary type="html">
Here is a summary of our story
</summary>
</entry>
<entry>
<title>Headline #2</title>
<author>
<name>John Smith</name>
</author>
<link rel="alternate"
href="http://www.oursite.com/our-slug-2/" />
<id>1235</id>
<updated>2013-08-13T23:45:43-04:00</updated>
<summary type="html">
Here is a summary of our …Run Code Online (Sandbox Code Playgroud)