You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Rebhan, Gilbert" <Gi...@huk-coburg.de> on 2006/01/17 08:38:57 UTC
xmlproperties and for loop
Hi,
we want to switch our property files to xml format.
Now i'm looking for the best structure of that xml file.
i thought of =
<?xml version="1.0" encoding="UTF-8"?>
<test>
<modul.0>
<label>v_1_0_0_1</label>
<name>Project 1</name>
<at>y</at>
</modul.0>
<modul.1>
<label>v_2_0_0_3</label>
<name>Project 2</name>
<at>n</at>
</modul.1>
<modul.2>
<label>v_2_2_0_1</label>
<name>Project 3</name>
<at>n</at>
</modul.2>
</test>
to access all modules within a for loop i have =
<project name="bla" default="main" basedir=".">
<!-- Import AntContrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<xmlproperty file="T:/test/props.xml" keeproot="false"/>
<target name="main">
<propertyselector property="module"
delimiter=","
match="modul\.\d"
select="\0"
casesensitive="false"
distinct="true" />
<for list="${module}" param="msection">
<sequential>
<echo>${@{msection}}</echo>
<var name="mname" unset="true" />
<script language="javascript">
mname=project.getProperty("@{msection}.name");
project.setNewProperty("mname", mname);
</script>
<echo>${mname}</echo>
<var name="mlabel" unset="true" />
<script language="javascript">
mlabel = project.getProperty("@{msection}.label");
project.setNewProperty("mlabel", mlabel);
</script>
<echo>${mlabel}</echo>
<var name="mat" unset="true" />
<script language="javascript">
mat = project.getProperty("@{msection}.at");
project.setNewProperty("mat", mat);
</script>
<if>
<equals arg1="${mat}" arg2="y"/>
<then>
<echo>${mname} already deployed !!</echo>
</then>
</sequential>
</for>
</target>
</project>
Instead of the echos there will be the real work later, i.e. checkout
...
Question =
is there a better way, should i have another structure for my xml
property file ?
Thanks for any hints !
Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org