Hmmm. Steve Lawrence is right. XML normalizes CR to LF. But I'm wondering if you just need to use dfdl:outputNewLine="%CR;%LF;" property. This would make the output line endings into CRLF when unparsing.
This is not the default setting for this property. By default this property gets its value from the variable $dfdl:outputNewLine which has default value of %LF;. ________________________________ From: Costello, Roger L. <coste...@mitre.org> Sent: Friday, April 5, 2019 9:25 AM To: users@daffodil.apache.org Subject: Bug in Daffodil? Hello DFDL community, My input file consists of a prolog of known format and a payload surrounded by parentheses. The payload consists of a series of text fields separated by hyphens. In some cases, the hyphen can be preceded by a new line, which can be a carriage return or CRLF combination. Here is a sample input file; I show it in a hex editor so you can see that some hyphens are preceded by CRLF and others by just a CR. [cid:image002.png@01D4EB91.79DBF2F0] Here is my DFDL schema: <xs:element name="input"> <xs:complexType> <xs:sequence> <xs:element name="prolog" type="xs:string" dfdl:terminator="%NL;" /> <xs:element name="payload" dfdl:initiator="(" dfdl:terminator=")"> <xs:complexType> <xs:sequence dfdl:separator="-" dfdl:separatorPosition="infix"> <xs:element name="field" type="xs:string" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> When I parse the input file using the DFDL schema, I get this XML: <input> <prolog>PROLOG</prolog> <payload> <field>A</field> <field>B</field> <field>C </field> <field>D</field> <field>E </field> <field>F</field> </payload> </input> That’s perfect. When I unparse the XML I get this (please note the bug (?) described in yellow): [cid:image006.png@01D4EB91.79DBF2F0]