開頭的值我需要一個Xpath表達式來選擇以特定值開頭的值。對於這個例子,我使用的是id字段。Xpath表達式查找以
@id=[starts-with(name(),'value')
以下不起作用。有沒有辦法使用帶有標籤之間的值的starts-with命令?或者在xpath中有另一種方法來選擇一個具有已知值的匹配值。
這裏是XML我想鑽的樣品爲:
<bean>
<id>AnnotationsBasedJMXAutoExporter</id>
<class>org.springframework.jmx.export.MBeanExporter</class>
<lazy-init>false</lazy-init>
<property>assembler
<!-- will create management interface using annotation metadata -->
<bean>
什麼XML應該由這個匹配? – 2013-05-17 10:34:02
刪除'='。 – choroba
@choroba不會只是匹配屬性標籤而不是標籤內的值?我在標籤內的值之後。不是標籤名稱 – Will