MartK
MartK

Reputation: 614

Append text after specific text in file with Ant

Is there any method in Ant that you can add text after any spesific text in text file? For example, I want to add an xml line after a <service> xml tag.

Upvotes: 0

Views: 843

Answers (3)

Rebse
Rebse

Reputation: 10377

For all xmlspecific tasks the use of xmltask is recommended. For simple appending of some xml use the echoxml task (since Ant 1.7) with attribute append="true"

Upvotes: 1

ewan.chalmers
ewan.chalmers

Reputation: 16235

To modify an XML document, the best method is probably to do an XSL transformation using the Ant XSLT task. The stylesheet for the task you describe sounds like it would be simple, and this Ant task makes it very straightforward to execute.

Upvotes: 3

moro
moro

Reputation: 101

You can write simple class for append text.
Then you can run it using ant's task 'java'
ant java task

Upvotes: 2

Related Questions