You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by David Leangen <da...@konova.com> on 2003/05/11 11:00:03 UTC

[JXPath and Ant] Using JXPath as an Ant task

Hello!

I would really like to use JXPath as an Ant task.

After having looked around all day for any documentation I could find, I
have set things up in the following way:

First, I set my classpath:

    <path id="jar.path">
      <fileset dir="${project.home}/lib">
        <include name="**/*.jar"/>
      </fileset>
    </path>
    <pathconvert property="jar.classpath" refid="jar.path"
targetos="windows"/>

"${project.home}/lib" contains commons-jxpath.jar and ant-sax2.jar, among
others.


Next, I declared my taskdef:

    <taskdef name="jxpath"
classname="org.apache.tools.ant.taskdefs.optional.JXPath"
classpath="${jar.classpath}"/>

As far as I know, I need to "initiate" jxpath with this tag:

    <jxpath/>

So, now I try to to reference something... anything, but all I get is the
verbatim text. For example, when I try:

    <echo message="${jxpath:/references}"/>

or

    <echo message="${jxpath:/references/build.xml/root/project/@name}"/>

All I get echoed back is:

    ${jxpath:/references}
    ${jxpath:/references/build.xml/root/project/@name}

Anybody have any idea of what I'm doing wrong?


Thanks!


Dave