Description
Users have reported that XML output contains things like
<x>foo "bar" baz</x>
which could just as reasonably be output as:
<x>foo "bar" baz</x>
We should really have an escapeForElementValueIfNeeded routine that returns either the escaped string, or the original string if no escaping was necessary. This would assume you are creating an XML element value, i.e., so no quoting is necessary of quotation marks.
The standard XML library escapify routines don't distinguish escaping for elements from escaping for attributes which is why they always convert quotation marks to entities. We already have to do our own escaping to deal with ASCII NUL so that we can carry that via a PUA remap.
It's also recommended in the XML 1.1 spec, that all the C0 and C1 control characters other than TAB and LF are converted to entities.
DAFFODIL-1559 is our ticket about dealing with the CR, CRLF preservation issue. It suggests CR should be converted to whether alone or in a CRLF pair.
DAFFODIL-919 is also about preserving whitespace generally, and escaping, dealing with CDATA regions.