Mmmh .... just a quick shot .... Have you tried a combination of copy, filterchain and linetokenizers? Maybe you have luck there ...
Jan >-----Ursprüngliche Nachricht----- >Von: Marcel Stör [mailto:[EMAIL PROTECTED] >Gesendet: Dienstag, 13. Februar 2007 16:11 >An: [email protected] >Betreff: Load tokens from a file into list > >I'd like to do some text substitution/translation in an XML file. > >Source: >[...] ><!-- locale-token1 --> >[...] ><!-- locale-token2 --> > >Target: >[...] ><foo locale="en"> > <title>My title</title> > <description>My description</description> ></foo> ><foo locale="de"> > <title>Mein Titel</title> > <description>Meine Beschreibung</description> ></foo> >[...] > >On the file system I'd have resource files such as >resources_en.properties, resources_de.properties, 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"> > <title>en.locale-token1.title</title> > <description>en.locale-token1.description</description> ></foo> ><foo locale="de"> > <title>de.locale-token1.title</title> > <description>de.locale-token1.description</description> ></foo> >-> 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, http://www.frightanic.com >Blog: http://frightanic.wordpress.com >Skype: marcelstoer > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
