Ant Modify Config File

Posted on by

Brian Stephenson Just as a followup, I do a similar thing as #3 in a project I am ANT'ing, and if you are not replacing in the XML file using regular expressions (e.g., you are just replacing 'password='foo' with 'password='bar'), you may be able to accomplish what you need to do with the much simpler-to-use command REPLACE, which does straight string replacement without regular expressions. Best thing about REPLACE is that you can replace characters that are considered escape characters in regular at Jan 21, 2009 at 1:36 pm. Just as a followup, I do a similar thing as #3 in a project I am ANT'ing, and if you are not replacing in the XML file using regular expressions (e.g., you are just replacing 'password='foo' with 'password='bar'), you may be able to accomplish what you need to do with the much simpler-to-use command REPLACE, which does straight string replacement without regular expressions. Best thing about REPLACE is that you can replace characters that are considered escape characters in regular expressions (*, /. I refer you to apache.org's ANT manual for the syntax of the REPLACE command, but if you want to use an external config file to manipulate, I think this might be the way to do it. Brian Stephenson ThorTech Solutions www.thortech-solutions.com. Alec Fernandez You should exercise caution when using replace to substitute tokens in xml files and property files because some chars &' need to be escaped in xml files.

Ant Modify Config FileAnt Change Config Files

You need to be sure that the string that you are inserting into the xml will never have such characters, or you must escape yourself. Similarly there are chars ( and non-Latin 1 chars) that need escaping in. Sil Charis Font Download more. properties files. If someone knows of an elegant solution to inserting such strings into files using ant, I would be grateful for at Jan 21, 2009 at 2:23 pm. You should exercise caution when using replace to substitute tokens in xml files and property files because some chars &' need to be escaped in xml files. You need to be sure that the string that you are inserting into the xml will never have such characters, or you must escape yourself.

Similarly there are chars ( and non-Latin 1 chars) that need escaping in.properties files. If someone knows of an elegant solution to inserting such strings into files using ant, I would be grateful for the input. Original Message----- From: Brian Stephenson Sent: Wednesday, January 21, 2009 2:36 PM To: Ant Users List Subject: Re: AW: Modify xml file Just as a followup, I do a similar thing as #3 in a project I am ANT'ing, and if you are not replacing in the XML file using regular expressions (e.g. Ludwig Xylophone Serial Number more. , you are just replacing 'password='foo' with 'password='bar'), you may be able to accomplish what you need to do with the much simpler-to-use command REPLACE, which does straight string replacement without regular expressions.