| xmltask, xpath related question | xmltask, xpath related question 2007-06-12 - By Rebhan, Gilbert
Hi,
with a given xmlfile as input for my buildscript <?xml version="1.0"?>
<referenzen> <projekt name="safir"> <modul name="SAFIR Base Application" label="r_1_5_13_23_thi"/> </projekt> <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"/> </projekt> </referenzen>
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)"/> </call> </xmltask> </target>
<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)"/> </call> </xmltask> </target>
<target name="cvscheckout"> <echo> ============== cvscheckout ================ Projektname = ${projektname} Modul = ${mname} Label = ${mlabel} ============== cvscheckout ================ </echo>
<cvscheckout cvsroot=":pserver:${user.name}@(protected):d:/cvsrepos/${projektname}" modul="'${mname}'" label="${mlabel}" path="Y:/tempwork" /> </target>
<target name="main" depends="init"/> </project>
so my script has one xmltask calling another xmltask for every projekt, the 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)
|
|
 |