ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Agnew <br...@oopsconsultancy.com>
Subject Re: parse XML file problem
Date Fri, 11 Mar 2005 09:28:13 GMT
If you use xmltask then you can call an Ant target for each file 
location, using something like:

<call path="/files/file/Location" target="antTarget">
   <param name="filename" path="../@name"/>
   <param name="type" path="../@type"/>
</call>

to call an Ant target 'antTarget' for each location, with the properties 
"filename" and "type" set appropriately. Note that I haven't tested the 
above, so it may require some tweaking.

You can get xmltask at http://www.oopsconsultancy.com/software/xmltask

Brian


Anand Krishniyer wrote:

> Hi
> I have an xml file similar to this
> <files>
>   <file name="a.jar" type="jar">
>       <Location>"c:/1"</Location>
>       <Location>"c:/2"</Location>
>   </file>
>   <file name="b.conf" type="conf">
>       <Location>"e:/1"</Location>
>       <Location>"e:/2"</Location>
>       <Location>"e:/3"</Location>
>   </file>   </files>
>
> Based on the file name and type I need to perform certain operations 
> on the file. How do I iterate through this xml and retrieve a set of 
> "locations" for a particular file i.e for file a.jar the locations are 
> c:/1,c:/2
>
> When I use XMLProperty task and For loop from ant-contrib I get 
> separate lists for file.name, file.type and file.location.
> for e.g
> file.name=a.jar,b.conf
> file.type=jar,conf
> file.location=c:/1,c:/2,e:1,e:2,e:3
>
> I need to identify the locations associated with a particular file. 
> How can I do this?
>
> Any ideas would be appreciated.
> Thanks
> Anand
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org


-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian @ oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message