Hi,
Like many others, I am following Ant 1.6 and am trying the B2-version.
Can someone show me how to put a "path" out into a file and read it in with <xmlproperty>?
-A working exampled, that is.
-----
To explain my request in another way, I have this piece of Ant-file, which works as intended:
...
<path
id="xxx-files.path"
>
<fileset dir="xxx">
<include name="*.something"/>
</fileset>
</path>
<macrodef
name="for-each-file"
>
<sequential>
<foreach
target="process-file"
param="file"
>
<path
refid="xxx-files.path"
/>
</foreach>
</sequential>
</macrodef>
...
When using the macro, a number of files are selected with the "path"-element and the target
"process-file" is invoked on each.
For my actual use, the body of the "path"-element may be more detailed than shown here and
I would like to expresses it as an individual, logical entity - I would really like to put
it out into a separate file and read the content in with the "xmlproperty"-task. As far as
I can tell from the documentation of "xmlproperty", this is possible!!
To do this, I have tried creating a file "xxxFiles.xml" with content like -
<xxx-file-selection>
<path
pathid="xxx-files.path"
>
<fileset dir="xxx">
<include name="*.something"/>
</fileset>
</path>
</xxx-file-selection>
- where I have changed the "id"-attribute of the "path"-element to "pathid", and then try
using it with the following piece of Ant:
<xmlproperty
file="xxxFiles.xml"
semanticAttributes="true"
/>
<macrodef
name="for-each-file"
>
<sequential>
<foreach
target="process-file"
param="file"
>
<path
refid="xxx-files.path"
/>
</foreach>
</sequential>
</macrodef>
But for some reason, the result is not the same. It runs okay, but no files are selected;
the target "process-file" is never called!
Is the construction possible? Is the new "macrodef" fooling around with "xmlproperty"? How
do I make the construction work as intended?
Regards,
Morten Sabroe Mortensen
|