【发布时间】:2015-07-02 15:13:50
【问题描述】:
假设我有以下 XML
<InvoiceLines>
<InvoiceLine>
<InsertionDate>29.01.2015</InsertionDate>
<Productnbr>0102</Productnbr>
</InvoiceLine>
<InvoiceLine>
<InsertionDate>29.02.2015</InsertionDate>
<Productnbr>0103</Productnbr>
</InvoiceLine>
</InvoiceLines>
我想获得 Productnbr = 0103 的 InvoiceLine 的插入日期。如果我要写 xpath,我会写类似:
//InvoiceLine[./Productnbr='0103']/InsertionDate
但我想使用 GPath,因为我在代码中使用了 XMLSlurper。有没有办法将谓词应用于 GPath?谢谢
【问题讨论】:
标签: xpath groovy xmlslurper gpath