To clarify, the XML text infoset outputter will always pretty print with
the CLI, but if used via the API I believe has an option to disable
pretty printing.

The other xml infoset outputters (scala-xml, jdom, w3cdom) do not pretty
print. Maybe the XML text infoset outputter should default to off to
match their behavior.

- Steve

On 11/14/19 11:06 AM, Beckerle, Mike wrote:
> The Daffodil CLI should have options to pretty print or not pretty print.  
> I'll 
> add a JIRA ticket for this. I think if you use the streaming feature 
> (--stream 
> option), it doesn't pretty print, but I haven't tried it recently.
> 
> The spaces you see inserted by Daffodil's pretty printing are XML 
> "insignificant" whitespace in that they are 100% whitespace nodes appearing 
> between element children in element-only content. Unless you use the 
> xml:space="preserve" attribute (which we don't), applications are free to 
> mess 
> with these inter-element whitespaces. They don't correspond to anything in 
> the 
> source input data. They're just pretty printer artifacts.
> 
> We don't insert spaces before or after simple element content. (I've seen 
> other 
> tools do this. Daffodil does not.)  The characters in the DFDL infoset for a 
> simple element become the characters in the corresponding XML simple element.
> 
> I didn't see that happening in your example, but if that was happening it 
> would 
> clearly be a bug. The spaces I did see inserted are between elements.
> 
> --------------------------------------------------------------------------------
> *From:* Costello, Roger L. <[email protected]>
> *Sent:* Thursday, November 14, 2019 8:20 AM
> *To:* [email protected] <[email protected]>
> *Subject:* Daffodil (erroneously) adds space symbols between elements and 
> within 
> elements
> 
> Hi Folks,
> 
> I believe this is a bug.
> 
> Issue #1: Daffodil is adding 2 space characters (hex 20) after an XML end tag 
> and its following start tag.
> 
> Issue #2: I have found that for lines of input that contain just whitespace, 
> Daffodil adds 2 space characters between the XML start tag and the end tag.
> 
> Issue #2 is clearly a violation of the XML specification – a parser may not 
> add 
> or remove any data from an element. Issue #1 one might quibble with, but I 
> believe it should be considered an error. If I want the XML indented, I’ll 
> use a 
> pretty printer; I don’t want Daffodil indenting for me.
> 
> See graphic below for an example of Issue #1.  /Roger
> 

Reply via email to