When I have some properties to read from an XML document I usually use an
XSLT to pre-transform it simple java properties file. It works very nicely.
It is very easy to select the data you need in the XSLT and then it is very
easy to read it inside Ant.

You could very easily do a for-each in XSLT to enumerate the filenames
inside a single property that you can use in ant-contrib's <for>
<propertycopy>

SAMPLE intermediate file:

filenames=cfg/template,bin/processes_check.sh
cfg/template.user=true
bin/processes_check.sh.user=yaronr  

RQ: not sure the / works in property names but I believe it should


//Benoit

-----Original Message-----
From: Yaron Ruckenstein [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 15:34
To: Ant-User
Subject: Iteration on XML data


Hi,

I would like to implement the following process:
1. Read a list of entries from a file, preferably XML file,
   each entry has the following data:
   - name of a file in the CM
   - name of a CM user
   - name of the file's version in the CM
   Example:
        <list source="2.5/dev" target="2.5/reg" count="2">
                <file name="cfg/template" isdir="true" user="integ"
comment="updated"/>
                <file name="bin/processes_check.sh" user="yaronr"
version="5"/>
        </list>

2. For each such entry, I want to check out the file from
   my development CM project, and check it in the controlled
   CM project, with the relevant data.

My problem is that I don't know how to get the data of each entry.

If I load this example file, the duplicated values are ignored.
If I change the file entry to be file1, file2 ... then I get all the
data but then I have problem accessing it, because I need an iteration
mechanism.

Maybe if I had a "for index=1 to ${count}" then I could build temporary
properties
(using the ant-contrib propertycopy) and then pass them to another target.

I'll be happy to get your help,
Thanks in advance,
Yaron.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to