You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.xml 1.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <project name="embed-test" default="main" basedir=".">
  2. <property name="ant.src" location="../.." />
  3. <property name="junit.jar" location="${ant.src}/lib/junit.jar" />
  4. <import file="build.xml" />
  5. <target name="main" >
  6. <path id="myJars" >
  7. <pathelement path="${junit.jar}" />
  8. <pathelement path="${jxpath.jar}" />
  9. <pathelement path="${ant.home}/lib/ant-sax2.jar" />
  10. </path>
  11. <systemPath pathRef="myJars"/>
  12. <junit id="replacedJunit" />
  13. <echo message="toString sample: ${toString:replacedJunit}" />
  14. <!-- This is Taksdef2.java - it'll use the systemPath as parent loader
  15. -->
  16. <taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPath"
  17. name="jxpath" />
  18. <!-- Init JxPath. '/' is the project -->
  19. <jxpath/>
  20. <echo message="jxPath /targets[1]: ${jxpath:/targets[1]}" />
  21. <echo message="jxPath /references: ${jxpath:/references}" />
  22. <echo message="jxPath /references[@name='myJars']: ${jxpath:/references[@name='myJars']}" />
  23. <echo message="jxPath /references/myJars: ${jxpath:/references/myJars}" />
  24. <!-- This is XMLDOM.java - a datatype that holds an xml DOM -->
  25. <typedef name="xmldom" classname="org.apache.tools.ant.types.XMLDOM"/>
  26. <!-- Init XMLDOM. The DOM of file test.xml will be referenced via the id-->
  27. <xmldom id="test.xml" file="test.xml"/>
  28. <echo message="XMLDOM: ${jxpath:/references/test.xml/root/project/@name}" />
  29. </target>
  30. <target name="test-import" >
  31. <antcall target="embed.main" />
  32. </target>
  33. </project>