Java Mailing List Archive

Apache Ant Archive

» Ant Users List
» Ant Developers List
xmltask, xpath related question

xmltask, xpath related question

2007-06-12       - By Rebhan, Gilbert


with a given xmlfile as input for my buildscript
<?xml version="1.0"?>

   <projekt name="safir">
       <modul name="SAFIR Base Application" label="r_1_5_13_23_thi"/>
   <projekt name="kuba">
       <modul name="KUBA" label="r_1_0_0_0_za_rc26"/>
       <modul name="PONE" label="r_1_0_0_0_za_rc26"/>

i need to call a cvscheckout macrodef for every modul found in the xml;
the cvsroot varies in the projekt name attribute.

I have a working script
<?xml version="1.0"?>

<project name="bla" default="main" basedir=".">

 <!-- // Taskdefs -->
 <!-- Import XMLTask -->
 <taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
 <!-- Taskdefs // -->

 <!-- // Import MacroDefs -->
 <import file="common_macros.xml" optional="false" />
 <!-- Import MacroDefs // -->

 <target name="init">
   <xmltask source="Reference.xml">
     <call path="//projekt" target="precvscheckout" >
       <param name="projektname" path="@(protected)"/>

 <target name="precvscheckout">
   <echo>... in precvscheckout</echo>

   <xmltask source="Reference.xml">
     <call path="//projekt[@(protected)='${projektname}']/modul"
target="cvscheckout" >
       <param name="mname" path="@(protected)"/>
       <param name="mlabel" path="@(protected)"/>

 <target name="cvscheckout">
 ============== cvscheckout ================
     Projektname = ${projektname}
     Modul       = ${mname}
     Label       = ${mlabel}
 ============== cvscheckout ================


 <target name="main" depends="init"/>

so my script has one xmltask calling another xmltask for every projekt,
second xmltask is called for every modul.

is there a more elegant, shorter  approach with xpath ?

Regards, Gilbert

To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 - Jax Systems, LLC, U.S.A.