こんにちは私はPythonのminidomモジュールを理解するのに苦労しています。
私は次のようなxmlを持っています:
<Show>
<name>Dexter</name>
<totalseasons>7</totalseasons>
<Episodelist>
<Season no="1">
<episode>
<epnum>1</epnum>
<seasonnum>01</seasonnum>
<prodnum>101</prodnum>
<airdate>2006-10-01</airdate>
<link>http://www.tvrage.com/Dexter/episodes/408409</link>
<title>Dexter</title>
</episode>
<episode>
<epnum>2</epnum>
<seasonnum>02</seasonnum>
<prodnum>102</prodnum>
<airdate>2006-10-08</airdate>
<link>http://www.tvrage.com/Dexter/episodes/408410</link>
<title>Crocodile</title>
</episode>
<episode>
<epnum>3</epnum>
<seasonnum>03</seasonnum>
<prodnum>103</prodnum>
<airdate>2006-10-15</airdate>
<link>http://www.tvrage.com/Dexter/episodes/408411</link>
<title>Popping Cherry</title>
</episode>
もっときれい:http ://services.tvrage.com/feeds/episode_list.php?sid = 7926
そして、これはそれから読み取ろうとしている私のPythonコードです:
xml = minidom.parse(urlopen("http://services.tvrage.com/feeds/episode_list.php?sid=7926"))
for episode in xml.getElementsByTagName('episode'):
for node in episode.attributes['title']:
print node.data
各エピソードからすべてのデータを取得したいので、実際のエピソードデータを取得できません。さまざまなバリエーションを試しましたが、動作させることができません。ほとんど私は<DOM Element: asdasd>
戻ってきます。私は各エピソード内のデータのみを気にします。
助けてくれてありがとう