mbeckerle commented on a change in pull request #468:
URL: https://github.com/apache/incubator-daffodil/pull/468#discussion_r543384387



##########
File path: 
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SpecifiedLengthUnparsers.scala
##########
@@ -385,8 +388,11 @@ class SpecifiedLengthPrefixedUnparser(
   override lazy val childProcessors = Vector(prefixedLengthUnparser, eUnparser)
 
   override def unparse(state: UState): Unit = {
-    // create a "detached" element that the prefix length will be used to 
unparse
-    val plElem = Infoset.newElement(prefixedLengthERD).asInstanceOf[DISimple]
+    // Create a "detached" DIDocument with a single child element that the
+    // prefix length will be parsed to. This creates a completely new
+    // infoset and parses to that, so care is taken to ensure this infoset
+    // is only used for the prefix length parsing and is removed afterwards
+    val plElem = Infoset.newDetachedElement(state, 
prefixedLengthERD).asInstanceOf[DISimple]

Review comment:
       I would wait for the next pass of profiling. A DFDL schema that makes 
extensive use of prefixed lengths (such as for every string) would be 
interesting to have here, but in my experience that is most common in mainframe 
data (from PL/1 actually. Cobol data is more commonly fixed length), which we 
don't (yet) see much of. 




----------------------------------------------------------------
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]


Reply via email to