Hi,

Am 11.01.2017 um 10:04 schrieb tobias.w...@t-systems.com:
> I`m reading a xml configuration object with a xml element containing a comma 
> separated string:
> 
> <SSLEnabledProtocols>TLSv1.1,TLSv1.2</SSLEnabledProtocols>
> 
> I archive this by setting explicitly a ListDelimiterHandler
> 
> this.xmlConfigBuilder = new 
> FileBasedConfigurationBuilder<XMLConfiguration>(ExtendedXMLConfiguration.class)
>                                         
> .configure(params.xml().setFile(configFile).setExpressionEngine(new 
> XPathExpressionEngine())
>                                                         
> .setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
> 
> 
> and the reading is fine, but when I write this out I got separate xml 
> elements for each value instead of the same comma separated value element.
> 
> this.xmlConfigBuilder.save();
> 
> <SSLEnabledProtocols>TLSv1.1</SSLEnabledProtocols>
> <SSLEnabledProtocols>TLSv1.2</SSLEnabledProtocols>
> 

the current implementation of XMLConfiguration internally always splits
strings containing the delimiter character on reading and creates
multiple internal node objects for the single values. This is required
to handle queries correctly that operate on the internal node model. So
when writing out such a configuration the original format is lost and
multiple list nodes are created.

I would, however, assume that a change in the format only occurs if
there is a change in the value of the property or if the content of a
configuration is copied into another one. When loading an XML file the
configuration stores the original DOM and applies changes on it as
necessary. That way the original format should be kept as close as
possible. Are there such changes in your use case?

Oliver

> 
> 

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

Reply via email to