1
我目前正在解析維基百科轉儲,試圖提取一些有用的信息。解析發生在XML中,我只想提取每個頁面的文本/內容。現在我想知道如何在另一個標籤內的標籤內找到所有文本。我搜索了類似的問題,但只發現了單個標籤有問題的問題。這裏是什麼,我想實現一個例子:Python:從XML樹中的標記中提取文本
<revision>
<timestamp>2001-01-15T13:15:00Z</timestamp>
<contributor>
<username>Foobar</username>
<id>65536</id>
</contributor>
<comment>I have just one thing to say!</comment>
<text>A bunch of [[text]] here.</text>
<minor />
</revision>
<example_tag>
<timestamp>2001-01-15T13:15:00Z</timestamp>
<contributor>
<username>Foobar</username>
<id>65536</id>
</contributor>
<comment>I have just one thing to say!</comment>
<text>A bunch of [[text]] here.</text>
<minor />
</example_tag>
我怎樣才能提取文本標籤中的文本,但只有當它被包含在版本樹?