commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [configuration] Re: Space or single quote as a value in properties files
Date Fri, 05 Feb 2010 20:51:53 GMT
Am 05.02.2010 18:26, schrieb Asterios Katsifodimos:
> Thank you Oliver,
>
> However with some simple tests that I've ran, I saw that even
> XMLConfiguration does not support this feature.
>
> It would be nice to see that as an option in the Apache configuration
> module, at least for me, its been many times that I need such
> values in a configuration file.
>
> thank you again,
> --
> Asterios
>

With XMLConfiguration it is actually possible to have whitespace in 
property values, but you have to tell the XML parser that it should not 
trim these values. This can be achieved by adding the xml:space 
attribute on an XML element. Have a look at the following example 
extracted from our unit tests:

<space xml:space="preserve">
    <blanc> </blanc>
</space>

The value of the space.blanc property will be a space character. (Note 
that the xml:space attribute is a standard XML attribute, not a specific 
extension for XMLConfiguration).

Oliver

>
> On Thu, Feb 4, 2010 at 10:18 PM, Oliver Heger
> <oliver.heger@oliver-heger.de>wrote:
>
>> Am 04.02.2010 17:42, schrieb Asterios Katsifodimos:
>>
>>   Hi all,
>>>
>>> I would like to know if there is a way to set the value of a variable
>>> (key)
>>> to be the space character in a PropertiesConfiguration file.
>>>
>>> for example
>>>
>>> variable = " "
>>>
>>> could I use the double quotes to do that?
>>>
>>
>>  From looking at the code it seems that it is not possible to define a space
>> character as property value. All lines are trimmed after they were read.
>>
>> Unfortunately, double quotes are also not supported. I am not sure, would
>> it make sense to add support for this feature? What would be the exact
>> specification?
>>
>> Don't know whether this helps you, but with XMLConfiguration you can set
>> space characters as property values.
>>
>> Oliver
>>
>>
>>
>>> thank you,
>>> --
>>> Asterios Katsifodimos
>>> INRIA Saclay
>>> France
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message