You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2013/09/29 22:21:26 UTC

[jira] [Resolved] (CONFIGURATION-555) XMLConfiguration doesn't seem to be preserving whitespace for the current node where xml:space="preserve" is set.

     [ https://issues.apache.org/jira/browse/CONFIGURATION-555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Heger resolved CONFIGURATION-555.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0

There was indeed a bug with the handling of the xml:space attribute: the attribute value was only applied to sub elements, but not to the current element. This has been fixed in subversion in revision 1527396.

However, after this fix one test case was failing related to the copy constructor of {{XMLConfiguration}}. The reason is that now an XML element that does not have any content of its own (except for whitespace between its children), but has children and the xml:space attribute set to "preserve" is assigned a value consisting only of whitespace. When saving the configuration again, this additional whitespace value is written and scrambles formatting. This causes the test case to fail.

This special corner case has been addressed by doing a trim in this constellation anyway, independent on the value of the xml:space attribute - we simply assume that the value has no meaning. So in this case, {{XMLConfiguration}} behaves as before, while in other cases the xml:space attribute should now be evaluated correctly.

> XMLConfiguration doesn't seem to be preserving whitespace for the current node where xml:space="preserve" is set.
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-555
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-555
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.9
>         Environment: Windows 7, Java 7 64 bit.
>            Reporter: Dwayne Smurdon @ Predictable Data
>              Labels: xml:space
>             Fix For: 2.0
>
>
> if I give this in the configuration:
> <test xml:space="preserve"> a b c </test>
> It does not seem to preserve the whitespace on the current node.  However, if I do
>  
> <space xml:space="preserve>
>    <test> a b c </test>
> </space>
> it does preserve it. I would like to be able to turn on whitespace preservation on the current node without changing the path to my node.
> I tested my values by printing out values retrieved from getList() method.



--
This message was sent by Atlassian JIRA
(v6.1#6144)