You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2020/07/30 20:58:00 UTC

[jira] [Commented] (DAFFODIL-919) Update XML output to not strip whitespace

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

Mike Beckerle commented on DAFFODIL-919:
----------------------------------------

Note that the typical XML behavior when parsing XML text is xml:space="default", not xml:space="preserve".
In xml:space="default" mode:
* all CRLF become LF
* any simple element, leading and trailing whitespace are removed. 
* tabs are converted to single spaces
* more than one space in a row (after tabs are converted) are converted to a single space. 
Note that these rules mean that these two elements with string values are considered equivalent:

{code:xml}
<foo>bar</foo>

<foo>
  bar
</foo>
{code}
It's that freedom that sometimes allows XML printers or IDE tools reformatting XML to clobber values of elements of simple type because in DFDL of course these are not at all equivalent. 

So the representation of the DFDL Infoset in XML really does pretty much *have to* look carefully at whether a string contains any whitespace that XML is free to muck with. And if so surround it by CDATA (create a PCData node), or add the xml:space='preserve' attribute to the element. 



> Update XML output to not strip whitespace
> -----------------------------------------
>
>                 Key: DAFFODIL-919
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-919
>             Project: Daffodil
>          Issue Type: Bug
>          Components: CLI, Debugger, General
>            Reporter: Steve Lawrence
>            Priority: Major
>
> The XML pretty printers we use (in both the debugger and the CLI output) collapses all whitespace. However, whitespace can be meaningful. We should either have an option to not collapse whitespace, or to just make it the default.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)