On Thu, 2008-02-21 at 09:56 +0100, Thorsten Scherler wrote: > Hi all, > > to harmonize the definition of properties IMO we should limit us to one > file. This should be forrest.properties.xml. >
Actually doing a wee bit research I wonder why we are not using the properties dtd from sun: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <entry key="plugin.TestPlugin">com.plugin.test.TestPluginModule</entry> <entry key="messages.TestPlugin">TestPluginMessages.properties</entry> </properties> This has the benefit to do a Properties properties = new Properties(); try { InputStream xmlStream = getClass().getResourceAsStream("forrest.properties.xml"); if( xmlStream == null ) { //throw some error } properties.loadFromXML(xmlStream); } catch (IOException exception) { // throw exception } salu2 > I played around: > Index: forrest.build.xml > =================================================================== > --- forrest.build.xml (revision 629705) > +++ forrest.build.xml (working copy) > @@ -77,6 +77,9 @@ > <!-- people should use -D switch, or <ant><property>s to override these > --> > <property name="project.home" location="." /> > - <property file="${project.home}/forrest.properties" /> > + <xmlproperty file="${project.home}/forrest.properties.xml" > + semanticAttributes="true" keepRoot="false"/> > + <echoproperties destfile="${project.home}/filter.properties"/> > > The last line is for debugging, but till now I did not get the > properties as I want them. > > It will result in something like: > property=pelt,.fv,group,project > property.name=dispatcher.theme,dispatcher.theme-ext,group-name,project-name > > However regarding > http://ant.apache.org/manual/CoreTasks/xmlproperty.html if I enable > semanticAttributes and use: > <properties> > <!-- > # codename: Dispatcher > # Dispatcher is using a fallback mechanism for theming. > # You can configure the theme name and its extension here > --> > <property id="dispatcher.theme" value="pelt"/> > <property id="dispatcher.theme-ext" value=".fv"/> > ... > > I expected to find > dispatcher.theme=pelt > but i now only get: > property=pelt,.fv,group,project > > Somebody had used the <xmlproperty/> successfully? > > salu2 -- Thorsten Scherler thorsten.at.apache.org Open Source Java consulting, training and solutions
