ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilbert Rebhan <...@schillbaer.de>
Subject Re: how to copy and edit a section of a text file
Date Thu, 09 Oct 2008 20:56:20 GMT
ca_iancu schrieb:
>> Can you provide a little more details, xmlfile how it is and how it
> More details, certainly! I need to find/read/duplicate a section of an xml
> file, then append it and make a simple change to the added section. I need
> to go from:
> 
>  <?xml version="1.0" encoding="UTF-8"?>
> <root>
> 	<device>
> 	    <device name="some_device">
> ..........a number of lines of properties here (irrelevant, unchanged)
>      </device> 
> 	</device>
> </root>

hm, still not clear for me ...

> to the following:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
> 	<device>
> 	    <device name="some_device">
> ..........a number of lines of properties here (irrelevant, unchanged)
>      </device> 
>      
>      <device name="some_other_new_device">
> ..........a number of lines of properties here (irrelevant, unchanged)
>      </device> 
> 	</device>
> </root>

you mean copy one name attribute
<device>
  <device name="attribute to copy">
  <device name="...">
...
</device>

and append it as
<device>
  <device name="copy of attribute to copy">
  <device name="...">
...
</device>

??

> That's it. The problem for me is: copy the text in a variable, then append
> right after the end of the existing text. I briefly looked at the xmltask
> but it seemed like what it does is read an xml file, and then it sets the
> existing fields to ant properties. It didn't seem like it's something I
> could use for text processing. 

oh, the xml task is great for editing xml files, that's what
xmltask is made for ;-)

Regards, Gilbert

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


Mime
View raw message