[ 
https://issues.apache.org/jira/browse/DAFFODIL-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17168147#comment-17168147
 ] 

Mike Beckerle edited comment on DAFFODIL-2346 at 7/1/22 8:45 PM:
-----------------------------------------------------------------

Suggested fix here is to add a tunable for Daffodil that affects the various 
XML InfosetOutputters that says whether simple XML elements containing 
whitespace should get
 * prefer cdata bracketing
 * {color:#de350b}-prefer xml:space="preserve" attribute used on the 
element-{color}
 * nothing done (current behavior)

It's a separate issue if the default for this should be current behavior, or 
one of the other settings.

The changes are going to be noticed (and not welcome) to users who compare data 
output using regular text diff type comparison.

However, these changes should be benign if output is compared using XML-aware 
comparison, such as the TDML runner for tests.

If we're not going to change existing behavior, but different default behavior 
is considered desirable in the future, then we need some way for users to 
specify a set of defaults to be used for configuration of Daffodil tunables 
that chooses more modern, non-legacy-compatible values for them. What I mean by 
that is the default for this suggested new tunable may have to be "none" 
meaning no change in behavior, but for anything newly developed, you really 
want this tunable setting to be "preferCDATABracketing". We need a way for a 
user to say, put some config file on their classpath which contains settings of 
tunables to be auto-discovered by daffodil. Or perhaps in an enviroment 
variable. DAFFODIL_AUTO_CONFIG="....filename...".


was (Author: mbeckerle):
Suggested fix here is to add a tunable for Daffodil that affects the various 
XML InfosetOutputters  that says whether simple XML elements containing 
whitespace should get
* prefer cdata bracketing
* prefer xml:space="preserve" attribute used on the element
* nothing done (current behavior)

It's a separate issue if the default for this should be current behavior, or 
one of the other settings.

The changes are going to be noticed (and not welcome) to users who compare data 
output using regular text diff type comparison. 

However, these changes should be benign if output is compared using XML-aware 
comparison, such as the TDML runner for tests. 

If we're not going to change existing behavior, but different default behavior 
is considered desirable in the future, then we need some way for users to 
specify a set of defaults to be used for configuration of Daffodil tunables 
that chooses more modern, non-legacy-compatible values for them. What I mean by 
that is the default for this suggested new tunable may have to be "none" 
meaning no change in behavior, but for anything newly developed, you really 
want this tunable setting to be "preferCDATABracketing". We need a way for a 
user to say, put some config file on their classpath which contains settings of 
tunables to be auto-discovered by daffodil. Or perhaps in an enviroment 
variable. DAFFODIL_AUTO_CONFIG="....filename...".

> XML Output needs option to use <![CDATA[     ]]> around simple element values 
> containing whitespace.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: DAFFODIL-2346
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2346
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>    Affects Versions: 2.6.0
>            Reporter: Mike Beckerle
>            Assignee: Varun Zaver
>            Priority: Major
>
> It is incredibly painful to take the XML output, pretty print it to make it 
> readable, and find out that this has mangled the significant whitespace 
> inside element values. 
> In general, since whitespace within simple values is considered fungible in 
> XML, we have to protect whitespace that is truly part of the DFDL infoset. 
> I think CDATA bracketing is preferable to replacing whitespace characters 
> with XML escaping like &amp;#x20; 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to