我有以下XML特定值的下一個元素:如何獲得包含文本使用引入nokogiri
<w:r w:rsidR="00AB3D3B">
<w:t xml:space="preserve">His sister </w:t>
</w:r>
<w:ins w:author="Chell" w:date="2016-10-02T11:19:00Z" w:id="5">
<w:r w:rsidR="00AB3D3B">
<w:t>P</w:t>
</w:r>
</w:ins>
<w:bookmarkStart w:id="6" w:name="_GoBack"/>
<w:bookmarkEnd w:id="6"/>
<w:del w:author="Chell" w:date="2016-10-02T11:19:00Z" w:id="7">
<w:r w:rsidDel="00AB3D3B" w:rsidR="00AB3D3B">
<w:delText>p</w:delText>
</w:r>
</w:del>
<w:r w:rsidR="00AB3D3B">
<w:t>olley had a sharp eye for detail.</w:t>
</w:r>
我選擇所有插入的節點:
@insertions = @file.xpath("//w:ins")
第一要素是:
<w:ins w:author="Chell" w:date="2016-10-02T11:19:00Z" w:id="5">
<w:r w:rsidR="00AB3D3B">
<w:t>P</w:t>
</w:r>
</w:ins>
我需要得到一個包含標籤<w:del>
和文本的下一個元素= 「P」。我不能使用node.next_element
,因爲它會返回書籤元素。
我該如何與Nokogiri做到這一點?
感謝har07奇妙的答案。我從來沒有見過這種方法 - 兄弟姐妹。非常瞭解更多。 – chell