ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Stör <>
Subject Load tokens from a file into list
Date Tue, 13 Feb 2007 15:10:42 GMT
I'd like to do some text substitution/translation in an XML file.

<!-- locale-token1 -->
<!-- locale-token2 -->

<foo locale="en">
	<title>My title</title>
	<description>My description</description>
<foo locale="de">
	<title>Mein Titel</title>
	<description>Meine Beschreibung</description>

On the file system I'd have resource files such as,, etc. containing 
key/value pairs for the tokens such as:
locale-token1.title = My title
locale-token1.description = My description

I thought I could implement this as a two-phase process:

1. replace each token with the basic XML structure. So, <!-- 
locale-token1 --> would then be replaced with
<foo locale="en">
<foo locale="de">
-> antcontrib foreach task
2. Replace all remaining tokens with the content of defined in the 
corresponding resource files.
-> Ant replace task with properties files

Are there easier ways to achieve this? How would I parse my source file 
in the first place to obtain a list of all tokens (to feed to the 
foreach task)?

Marcel Stör,
Skype: marcelstoer

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message