File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Modifying XML file with ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Modifying XML file with ANT" Watch "Modifying XML file with ANT" New topic

Modifying XML file with ANT

Ranch Hand

Joined: Mar 06, 2001
Posts: 123
I have a XML configuration file which is something like this


Now, I want to write a build.xml which modifies XYZ to say ABC
What's the bext way to do this? I tried using a ugly creation of
filterset with copy task. Howvever, I would prefer to use

<filterset id="myFilterSet" begintoken="<name>" endtoken="</name>">
<filter token="XYZ" value="ABC" />

but unfortunately doesn't work because of special characters ("<")

Any ideas?

[ October 28, 2004: Message edited by: Prashanth Joisha ]
Michael Morrison

Joined: Oct 28, 2004
Posts: 1
Look at xmltask from It makes manipulating XML files from a build easy.
Daniel Beck

Joined: May 21, 2004
Posts: 12
Or better use xslt :-).
It's not so hard.

Best regards<br />---> Daniel
I agree. Here's the link:
subject: Modifying XML file with ANT
It's not a secret anymore!