aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "ANT Task to modify XML files?" Watch "ANT Task to modify XML files?" New topic
Author

ANT Task to modify XML files?

a chang
Greenhorn

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 - org.apache.tools.ant.taskdefs.XmlProperty - 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: http://aspose.com/file-tools
 
subject: ANT Task to modify XML files?
 
Similar Threads
including xml file in .ear file
error executing ant script
Loadjava program
[ANT] How to add/remove classpath of a project?
modifying an existing jar file using ant