ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject xmltask, xpath related question
Date Tue, 12 Jun 2007 14:49:35 GMT

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="@name"/>
      </call>
    </xmltask>
  </target>

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

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

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

    <cvscheckout
cvsroot=":pserver:${user.name}@cvsprod: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@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message