-
Notifications
You must be signed in to change notification settings - Fork 3
/
ant-test.xml
31 lines (28 loc) · 1.17 KB
/
ant-test.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<project name="xpath-test" default="run">
<taskdef name="xpath" classname="org.wiztools.ant.xpath.XPathTask"
classpath="target/ant-xpath-task-1.0-SNAPSHOT.jar"/>
<target name="run">
<!-- Multi-result Example -->
<xpath document="pom.xml"
xpath="/project/dependencies/dependency/groupId"
outputproperty="groupIds"
multinoderesult="true"/>
<echo>${groupIds}</echo>
<!-- Single-result Example -->
<xpath document="pom.xml"
xpath="/project/version"
outputproperty="pomVersion"/>
<echo>${pomVersion}</echo>
<!-- when there is no match on the path -->
<xpath document="pom.xml"
xpath="/project/undefined"
outputproperty="undefinedNoDefault"/>
<echo>${undefinedNoDefault}</echo>
<!-- when there is no match on the path using the defaultValue property -->
<xpath document="pom.xml"
xpath="/project/undefined"
outputproperty="undefinedWithDefault"
defaultValue="not found"/>
<echo>${undefinedWithDefault}</echo>
</target>
</project>