You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Thorsten Scherler <th...@juntadeandalucia.es> on 2008/02/21 10:15:01 UTC
xmlproperties task
Hi all,
we at forrest are in the middle to harmonize the definition of our
properties system and we want to switch to an xml based on
(forrest.properties.xml).
We already use this file in the rest of our application. The format is
as follow:
<properties>
<property name="dispatcher.theme" value="pelt"/>
<property name="dispatcher.theme-ext" value=".fv"/>
</properties>
Doing a change in our core ant build did not brought the expected
result.
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 the above file slightly alternated:
<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
My question is, is this a bug or have I overlooked something?
salu2
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: xmlproperties task
Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Mon, 2008-02-25 at 12:52 +0000, Peter Reilly wrote:
> ANT svn (trunk) supports loadFromXML in the properties task.
> This has not been ported to the ANT 1.7 branch.
Nice. Thanks for this update, will checkout trunk and give it a go.
salu2
> Peter
>
> On Mon, Feb 25, 2008 at 12:21 PM, Thorsten Scherler
> <th...@juntadeandalucia.es> wrote:
> > On Fri, 2008-02-22 at 14:56 -0800, Bruce Atherton wrote:
> > > What I think you are missing is that the XML hierarchy translates into
> > > the name of the property. This is true whether you use Semantic
> > > Attributes or not, since they do not alter the name.
> >
> > Hmm, then I misunderstood
> >
> > http://ant.apache.org/manual/CoreTasks/xmlproperty.html
> > "Semantic Attributes
> > ...
> > id: The property is associated with the given id value."
> >
> > For me that sounds (and actually IMO makes awfully lot of sense) that if
> > I use @id, the property will use this id as name.
> >
> > Then the java xml files from properties.loadFromXML(...) method will not
> > work with the xmlproperty task either (let alone that they do not even
> > have a @id), since they look like:
> >
> > <?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>
> >
> > Is there interest to have a java compatible xml properties task, if so I
> > will likely need to write one for my current project and can submit a
> > patch.
> >
> > Thanks for your answer Bruce.
> >
> >
> > salu2
> > --
> > Thorsten Scherler thorsten.at.apache.org
> > Open Source Java consulting, training and solutions
> >
> >
> > ---------------------------------------------------------------------
> >
> >
> > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail: dev-help@ant.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: xmlproperties task
Posted by Peter Reilly <pe...@gmail.com>.
ANT svn (trunk) supports loadFromXML in the properties task.
This has not been ported to the ANT 1.7 branch.
Peter
On Mon, Feb 25, 2008 at 12:21 PM, Thorsten Scherler
<th...@juntadeandalucia.es> wrote:
> On Fri, 2008-02-22 at 14:56 -0800, Bruce Atherton wrote:
> > What I think you are missing is that the XML hierarchy translates into
> > the name of the property. This is true whether you use Semantic
> > Attributes or not, since they do not alter the name.
>
> Hmm, then I misunderstood
>
> http://ant.apache.org/manual/CoreTasks/xmlproperty.html
> "Semantic Attributes
> ...
> id: The property is associated with the given id value."
>
> For me that sounds (and actually IMO makes awfully lot of sense) that if
> I use @id, the property will use this id as name.
>
> Then the java xml files from properties.loadFromXML(...) method will not
> work with the xmlproperty task either (let alone that they do not even
> have a @id), since they look like:
>
> <?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>
>
> Is there interest to have a java compatible xml properties task, if so I
> will likely need to write one for my current project and can submit a
> patch.
>
> Thanks for your answer Bruce.
>
>
> salu2
> --
> Thorsten Scherler thorsten.at.apache.org
> Open Source Java consulting, training and solutions
>
>
> ---------------------------------------------------------------------
>
>
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: xmlproperties task
Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Fri, 2008-02-22 at 14:56 -0800, Bruce Atherton wrote:
> What I think you are missing is that the XML hierarchy translates into
> the name of the property. This is true whether you use Semantic
> Attributes or not, since they do not alter the name.
Hmm, then I misunderstood
http://ant.apache.org/manual/CoreTasks/xmlproperty.html
"Semantic Attributes
...
id: The property is associated with the given id value."
For me that sounds (and actually IMO makes awfully lot of sense) that if
I use @id, the property will use this id as name.
Then the java xml files from properties.loadFromXML(...) method will not
work with the xmlproperty task either (let alone that they do not even
have a @id), since they look like:
<?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>
Is there interest to have a java compatible xml properties task, if so I
will likely need to write one for my current project and can submit a
patch.
Thanks for your answer Bruce.
salu2
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: xmlproperties task
Posted by Bruce Atherton <br...@callenish.com>.
What I think you are missing is that the XML hierarchy translates into
the name of the property. This is true whether you use Semantic
Attributes or not, since they do not alter the name.
Your XML file actually defines the same property name over and over
again. If keepRoot were set to true, this would be
"properties.property", but since you specify that the root tag should be
ignored, the one property name is named "property".
What your XML should look like to get the results you want is:
<properties>
<dispatcher>
<theme>pelt</theme>
<theme-ext>.fv</theme-ext>
</dispatcher>
</properties>
Leave keepRoot set to false, and you don't need semanticAttributes
unless you prefer using the value attribute instead of the contents of
the tag or if you want to use Ant references inside the configuration file.
Thorsten Scherler wrote:
> Hi all,
>
> we at forrest are in the middle to harmonize the definition of our
> properties system and we want to switch to an xml based on
> (forrest.properties.xml).
>
> We already use this file in the rest of our application. The format is
> as follow:
>
> <properties>
> <property name="dispatcher.theme" value="pelt"/>
> <property name="dispatcher.theme-ext" value=".fv"/>
> </properties>
>
> Doing a change in our core ant build did not brought the expected
> result.
>
> 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 the above file slightly alternated:
> <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
>
> My question is, is this a bug or have I overlooked something?
>
>
> salu2
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org