[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: [jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly
From: "Pascal Essiembre (JIRA)" <jira () apache ! org>
Date: 2018-05-31 17:39:00
Message-ID: JIRA.13161965.1527217141000.75364.1527788340050 () Atlassian ! JIRA
[Download RAW message or body]
[ https://issues.apache.org/jira/browse/CONFIGURATION-703?page=com.atlassian.jira. \
plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16496896#comment-16496896 \
]
Pascal Essiembre commented on CONFIGURATION-703:
------------------------------------------------
Yes, but now that I think about it, even if the tests pass, I think the following \
would be safer (just reducing the count when dealing with space preserve):
{code:java}
boolean childrenFlag = hasChildren || (attributes.size() - \
(VALUE_PRESERVE.equals(attributes.get(ATTR_SPACE)) ? 1 : 0) > 1); {code}
That makes me wonder. I am not familiar with the entire logic, but why are we \
considering attributes as "children" for the purpose of preserving spaces? Shouldn't \
we care about child "elements" only? I mean, don't we want to preserve spaces in \
this context:
{code:xml}
<tag xml:space="preserve" attribute1="value1" attribute2="value2" attribute3="value3" \
...> </tagChild> {code}
> xml:space="preserve" does not handle blank strings properly
> -----------------------------------------------------------
>
> Key: CONFIGURATION-703
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-703
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: 2.2
> Reporter: Pascal Essiembre
> Priority: Major
>
> When using XMLConfiguration 2, tags containing only white spaces are not handled \
> properly when xml:space="preserve" is set. 'null' is returned instead of the \
> actual spaces. To reproduce:
> {code:java}
> XMLConfiguration xml = new BasicConfigurationBuilder<>(
> XMLConfiguration.class).configure(
> new Parameters().xml()).getConfiguration();
> FileHandler fh = new FileHandler(xml);
> fh.load(new StringReader("<test xml:space=\"preserve\"> </test>"));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs -> TEST: 'null'
> // Should be -> TEST: ' '
> {code}
>
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic