You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by gr...@tpg.com.au on 2005/12/19 08:07:44 UTC

Is there an ANT task to replace a in the source with the contents of the specified file???

Hi,

Is there an ANT task to replace a <TAG:filename> in the source with the
contents of the specified file???

That is I working with some scripting languages where I'd like to
identify common code and keep these in separate files (e.g. like JSP TAG
replacement concept but simpler).  What I'm looking for is a way to
specific a TAG in the source file, which within the TAG it identified
the file which has the common code.  Then when running the ANT task and
"building" from the SOURCE to the BUILD area the TAGS would be replaced
by the contents of the files.  

Any suggestions re how to do this with ANT?

An optional (ideal) extra would be the ability to handle recursion (i.e.
a file with a snippet of text itself could contain a TAG).

Thanks

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


Re: Is there an ANT task to replace a in the source with the contents of the specified file???

Posted by Ivan Ivanov <ra...@yahoo.com>.
Hello,

--- Petar Tahchiev <pa...@gmail.com> wrote:
> I am not quite sure that I understood your ideas
> clearly enough to answer
> this, but I would like to suggest you this: why not
> just use
> <filter token="<TAG:xxxx>"
> value="${property.Containg.The.Desired.String}"/>

In XML files you have to escape < and > with &lt; and
&gt;. So your example will look like:
<filter token="&lt;TAG:xxxx&gt;"
    value="${property.Containg.The.Desired.String}"/>

Regards
Ivan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: Is there an ANT task to replace a in the source with the contents of the specified file???

Posted by Petar Tahchiev <pa...@gmail.com>.
On 19/12/05, gregsfm@tpg.com.au <gr...@tpg.com.au> wrote:
>
> Hi,
>
> Is there an ANT task to replace a <TAG:filename> in the source with the
> contents of the specified file???
>
> That is I working with some scripting languages where I'd like to
> identify common code and keep these in separate files (e.g. like JSP TAG
> replacement concept but simpler).  What I'm looking for is a way to
> specific a TAG in the source file, which within the TAG it identified
> the file which has the common code.  Then when running the ANT task and
> "building" from the SOURCE to the BUILD area the TAGS would be replaced
> by the contents of the files.
>
> Any suggestions re how to do this with ANT?
>
> An optional (ideal) extra would be the ability to handle recursion (i.e.
> a file with a snippet of text itself could contain a TAG).
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
I am not quite sure that I understood your ideas clearly enough to answer
this, but I would like to suggest you this: why not just use
<filter token="<TAG:xxxx>" value="${property.Containg.The.Desired.String}"/>
<copy file="your.file" todir="${build.dir}" filtering="true"/>

This will copy your file to a destination directory replacing the pattern
<TAG:xxx> with anything that your propery holds.
Hope that helps!
--
Regards, Petar!