You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by EJ Ciramella <ec...@archivas.com> on 2005/05/03 20:43:47 UTC

Re: Looking for task to add text to file.

Would it make more sense to break up the file into other smaller ones 
if regexp doesn't work?  Then you could use loadfile for the header 
content, have a property to store the items you want to add and another 
loadfile for the rest of the document.  Then you could echo the three 
properties into a new file in the exact order you want.  Also, if 
you're doing loadfile, you could do expandproperties and turn any ${}'s 
in the files into their actual values.


On Apr 28, 2005, at 11:35 AM, Nir Geier wrote:

> To tell u the truth, im not worried.
> the entry i have to add is a text to teh list,
> all i want to to is to place anothe item in DTD list
> its pure text and only entry name.
>
>
> <!ELEMENT list(
> item1,
> item2,
> item3,
> ...
> itemx,
> -- add item here
> )>
>
> -----Original Message-----
> From: Brian Agnew [mailto:brian@oopsconsultancy.com]
> Sent: Thursday, April 28, 2005 4:31 PM
> To: Ant Users List
> Subject: Re: Looking for task to add text to file.
>
>
> Ok. Sounds like you're covering that (and you may want to worry about
> other XML entities - &amp; etc.). Your problem domain may be small
> enough to require such a solution, but once you have to worry about
> character encodings and the like then you'll run into other issues. 
> Butn
> like I say, it's all dependent on what you're trying to achieve
> (tactical vs.strategic and so on)
>
> Nir Geier wrote:
>
>> im using &#6x; to inser < >
>>
>>
>> -----Original Message-----
>> From: Brian Agnew [mailto:brian@oopsconsultancy.com]
>> Sent: Thursday, April 28, 2005 4:13 PM
>> To: Ant Users List
>> Subject: Re: Looking for task to add text to file.
>>
>>
>> If you're modifying XML then I'd strongly suggest using xmltask (I'm
>> biased here!) or equivalent.
>>
>> Why ? A simple text search/replace doesn't respect the character
>> encoding conventions within your XML, and doesn't respect entity
>> encoding. e.g. you want to insert the text "x < y". If you do that
>> directly using a simple text search/replace then you'll end up with
>> invalid XML.
>>
>> Brian
>>
>> Nir Geier wrote:
>>
>>
>>
>>> i didnt fin teh :
>>>
>>> 2) using <tail> and <head> filters while <move>ing
>>>  - extract part before
>>>  - extract part after
>>>  using <concat> to combine before, new and after parts
>>>
>>> you mentioned before.
>>>
>>> where are the tail and head? (which task?)
>>>
>>> Nir.
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>


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