stevedlawrence commented on a change in pull request #208: Output empty 
elements with self closing tags
URL: https://github.com/apache/incubator-daffodil/pull/208#discussion_r275991159
 
 

 ##########
 File path: 
daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/XMLTextInfosetOutputter.scala
 ##########
 @@ -97,19 +101,24 @@ class XMLTextInfosetOutputter(writer: java.io.Writer, 
pretty: Boolean = true)
   override def startComplex(complex: DIComplex): Boolean = {
     val name = getTagName(complex)
     if (pretty) outputIndentation(writer)
-    outputStartTag(complex, name)
+    outputStartTag(complex, name, complex.children.isEmpty)
 
 Review comment:
   I not sure if looking at ``complex.children.isEmpty`` is completly 
sufficient here. For exampe, if all the children of a complex element are from 
a hidden group, then ``complex.children`` won't be empty, but the resulting 
infoset won't have any childen.
   
   So instead of this, we might need something like a new function in DIComplex 
like``def hasVisibleChildren`` (I think there's a DFDL term for "visible" in 
this case) that iterates through the childNodes and determines if 1) there are 
no children or 2) all children are hidden.
   
   Or alterantively, since this information is needed twice (once in 
startComplex and again in endComplex), it might be more performatn to create a 
new boolean var in the DIComplex and toggle it once a non-hidden child is added?
   
   Might be other options, but I think this does need to take into acount 
hidden elements.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to