>Can you provide a little more details, xmlfile how it is and how it
>should look after editing/appending/replacing ?

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>

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>

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. 





Gilbert Rebhan wrote:
> 
> ca_iancu schrieb:
>> This is a commercial library. I want to use existing functionality from
>> Ant
>> to accomplish this task. I am certain it is possible, I just do not know
>> Ant
> 
> no, it's free, you even get the sources :-)
> Of course there are many ways to Rome, but when dealing
> with xml i recommend the xml task, as it works just fine
> 
> in your case with xmltask =
> 
> 1. searching with Xpath
> 2. put in a buffer | property
> 3. appending
> 
>> well enough yet. There has to be some sort of loop that can be created to
>> read from a file line by line and stop when a certain string is
>> encountered.
>> I can copy and edit the teaxt once I have it in a variable. 
> 
> Can you provide a little more details, xmlfile how it is and how it
> should look after editing/appending/replacing ?
> 
> Regards, Gilbert
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-copy-and-edit-a-section-of-a-text-file-tp19898362p19906328.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to