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

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

_(OBSOLETE - this comment is not correct. Leaving it here for posterity, but 
xml:space does not fix the issue, which is clear in later comments.)_

-It's possible adding xml:space="preserve" on the root (aka document) element 
of the XML will do the right thing, as that is supposed to instruct XML 
processors that whitespace is to be considered significant.-

-Putting this attribute on the root element however, may make it so nothing can 
pretty-print the XML.-

-It may be that putting xml:space="preserve" only on simple-elements with 
whitespace content is sufficient. However, that's actually more characters than 
CDATA bracketing.-

-Note that xml:space="preserve" is compatible with use of XML character 
entities like  whereas CDATA bracketing is not.-


was (Author: mbeckerle):
_(OBSOLETE - this comment is not correct. Leaving it here for posterity, but 
xml:space does not fix the issue, which is clear in later comments.)_

It's possible adding xml:space="preserve" on the root (aka document) element of 
the XML will do the right thing, as that is supposed to instruct XML processors 
that whitespace is to be considered significant.

Putting this attribute on the root element however, may make it so nothing can 
pretty-print the XML.

It may be that putting xml:space="preserve" only on simple-elements with 
whitespace content is sufficient. However, that's actually more characters than 
CDATA bracketing.

Note that xml:space="preserve" is compatible with use of XML character entities 
like  whereas CDATA bracketing is not.

> 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