stevedlawrence commented on a change in pull request #218: Implement
dfdl:choiceLength='explicit'
URL: https://github.com/apache/incubator-daffodil/pull/218#discussion_r286258931
##########
File path:
daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/SpecifiedLength2.scala
##########
@@ -460,6 +463,64 @@ class ElementUnusedUnparser(
}
+/**
+ * This is basically a simplified version of the
ElementUnusedUnparserSuspendableOperation.
+ * For explicit length choices, we do not need to handle length expressions,
choiceLength is
+ * simply a non-negative integer.
+ */
+class ChoiceUnusedUnparserSuspendableOperation(
+ override val rd: TermRuntimeData,
+ targetLengthInBits: Long)
+ extends SuspendableOperation {
+
+ /**
+ * determine delta between value length and target length
+ *
+ * and skip that many bits.
+ */
+ override def continuation(ustate: UState) {
+ val e = ustate.currentInfosetNode.asInstanceOf[DIElement]
Review comment:
I'm wondering if we might run into issues by usign the value length of the
current infoset node. For example, say we have a single complex element that is
a sequence of two choiceLengthKind="explicit" choices:
```xsd
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:choice dfdl:choiceLengthKind="explicit" dfdl:choiceLength="X">
....
</xs:choice>
<xs:choice dfdl:choiceLengthKind="explicit" dfdl:choiceLength="X">
....
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
```
When we unparse the choice unsed stuff, both choices are going to use the
length of foo to determine how much space is unused. But we really want the
length of the choice content, not the length of foo. Not sure how to handle
this, since there is nothing keeping track of the length of the choice content.
Do we need some representation in the infoset for a choice where the length of
the choice can be hung when choice length is explicit? I think we had this at
one point, but maybe got rid of it?
----------------------------------------------------------------
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