【发布时间】:2017-05-31 04:15:22
【问题描述】:
给定以下 XML:
<w:p>
<w:pPr>
<w:lang w:val="en-CA"/>
</w:pPr>
<w:ins>
<w:t>sections</w:t>
</w:ins>
<w:pPr>
<w:lang w:val="en-CA"/>
</w:pPr>
<w:r>
<w:t>I am</w:t>
</w:r>
</w:p>
我想选择后跟w:ins 或w:del 元素的w:pPr 元素。
我试过了:
doc.xpath("w:pPr[following-sibling::w:ins[1] or following-sibling::w:del[1]]")
它仍然返回第二个 w:pPr 元素,后面跟着一个 w:r 元素,所以这不是我要找的。p>
我该怎么做?
【问题讨论】: