ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Kost <s.k...@webmacher.de>
Subject RE: outputting a fileset as xml
Date Mon, 06 May 2002 08:50:36 GMT
Hi Dominique,

thanks a lot. it works. I didn't though as far as two stages are
required :-(.
I have just replaced the '<' and '>' so thats it is clean xml.

Stefan

PS.: slowly I think a knowledge base for ant would be great
> Don't write a task for that IMHO, just take Diane's cue, and do something
> like:
> 
>   <property name="nl"
>             value="${line.separator}" />
>   <property name="out"
>             value="${basePath}/xmlfiles-template.xml" />
> 
>   <fileset id="myfiles"
>            dir="${sourcePath}"
>            includes="**/ejb-jar.xml" />
> 
>   <pathconvert property="myfiles2"
>                dirsep="/"
>                pathsep="</file>${nl}  <file>"
>                refid="myfiles">
>     <!-- use a <map> if you need relative paths -->
>   </pathconvert>
> 
>   <delete file="${out}" />
>   <echo file="${out}" append="yes"
>         message="<files>${nl}  <file>" />
>   <echo file="${out}" append="yes"
>         message="@FILES@" />
>   <echo file="${out}" append="yes"
>         message="</file>${nl}</files>${nl}" />
> 
>   <copy file="${out}"
>         tofile="${basePath}/xmlfiles.xml"
>         overwrite="yes">
>     <filterset>
>       <filter token="FILES" value="${myfiles2}" />
>     </filterset>
>   </copy>
> 
> Might be a little longuish, but it's pure ANT, and should work (I use a
> similar technique to dynamically construct the Class-Path: manifest
> attribute of my JAR. Let me know if it works for you. --DD
> 
> -----Original Message-----
> From: Diane Holt [mailto:holtdl@yahoo.com] 
> Sent: Tuesday, April 30, 2002 4:53 AM
> To: Ant Users List
> Subject: Re: outputting a fileset as xml
> 
> --- Stefan Kost <s.kost@webmacher.de> wrote:
> > I've search the web, the mailing lists and even asked friends - but no
> > answer has been found.
> > I need a fileset as xml :
> > <files>
> >   <file>path-to-file-1</file>
> >   <file>path-to-file-2</file>
> >   <file>path-to-file-3</file>
> >   ...
> > </files>
> 
> Use <fileset> to get the set of files, <pathconvert> it to a list, then
> either use <foreach> to <echo> the text and files out to a file (if you
> can go with Ant1.5[soon to go beta]), or for-loop through them in a
> <script>.
> 
> Diane
> 
> =====
> (holtdl@yahoo.com)
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
-- 

 < W E B M A C H E R > 
EDV+INTERNETSERVICE GMBH

POST: August Bebel Str. 69
      04275 Leipzig

FON:  +49 341 30 34 833
FAX:  +49 341 30 34 840
WEB:  www.webmacher.de


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


Mime
View raw message