File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes ANT Task to modify XML files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "ANT Task to modify XML files?" Watch "ANT Task to modify XML files?" New topic

ANT Task to modify XML files?

a chang

Joined: Aug 17, 2005
Posts: 2
I am writing a custom ant task to modify an ant task build.xml file. What ant tasks are available to parse and modify an xml file? I want to find a property element with a specific name, and change an attribute called value. Any help would be great! thanks in advance!
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
I am not aware of any tasks that are packaged with ant that can accomplish this. I always recommend extending ant and writing your own task. This is pretty easy to do. There is a task - - but it only loads properties from an xml file.

You could either parse the xml or if it is a specific element, you could write a routine to search and replace the value of that element.
I agree. Here's the link:
subject: ANT Task to modify XML files?
jQuery in Action, 3rd edition