Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
AW: Using Java xml properties file with Ant

AW: Using Java xml properties file with Ant

2007-07-20       - By Jan.Materne@(protected)

>Good question.  Looking at the ant source it looks like the
>property value is overwritten with the new value concatenated
>onto the old value with a comma in between.  So the old value is lost.
>
>This is probably not the answer you are looking for but you
>could use ant contrib's foreach task to iterate over the list
>of values in temp.properties.entry.
>
>It would be nice if there were a way for the xmlproperty task
>to create props with an XPath like syntax.  Something like:
>
>temp.properties.entry(key="appName")  would return Name
>
>or even a simple array index, something like:
>
>temp.properties.entry(0)  would return Name as well
>
>But I don't see such a thing.  Maybe we are just missing it.


Without having a look into the source I dont think that you missed
something.

Have a look at this XML

<data>
  <entry one="foo1" two="foo2" three="foo3">foo-text</entry>
  <entry one="bar1" two="bar2" three="bar3">bar-text</entry>
</data>

What is the key? What is the data?
I could think that something like this could be useful:

<xmlproperty file="" prefix="A" key="two" data="three"/>
<xmlproperty file="" prefix="B" key="one" />
A.foo2=foo3
A.bar2?r3
B.foo1=foo-text
B.bar1?r-text

You specify the key and the data attributes and get the "hashmap".
Without specifying
the data attribute it defaults to the text().


Jan




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.