【发布时间】:2017-08-08 20:59:54
【问题描述】:
我目前正在解析维基百科转储,试图提取一些有用的信息。解析在 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>
如何提取文本标签内的文本,但仅当它包含在修订树中时?
【问题讨论】: