Created https://issues.apache.org/jira/browse/DAFFODIL-2636.
Now if someone would just volunteer to implement this.....:-) On Tue, Jan 25, 2022 at 11:55 AM Roger L Costello <[email protected]> wrote: > Still not fixed in Daffodil version 3.2.1 > > > > Bummer. > > > > /Roger > > > > *From:* Roger L Costello <[email protected]> > *Sent:* Thursday, December 2, 2021 8:00 AM > *To:* [email protected] > *Subject:* Re: Huh? Nillable complex type elements can only have '%ES;' > as their dfdl:nilValue property > > > > Hi Mike, > > > > 1. Would you get the DFDL committee to remove this restriction, please? > > > > 2. I have 350 data formats, each having dozens of fields with nillable > complexTypes. So there is a strong use case for removing the restriction. > > > > 3. The choice idea that you presented, although clever and interesting, is > not suitable. In the example I presented, the output XML should be one of > these: > > > > <MyField>-</MyField> > > > > <MyField> > > <DateTimeIso>…</DateTimeIso> > > </MyField> > > > > <MyField> > > <MonthName>…</MonthName> > > </MyField> > > > > With the technique you showed, the output would be one of these: > > > > <noValue>-</noValue> > > > > <MyField> > > <DateTimeIso>…</DateTimeIso> > > </MyField> > > > > <MyField> > > <MonthName>…</MonthName> > > </MyField> > > > > That first one -- <noValue> -- is not unacceptable to my community. > > > > /Roger > > > > *From:* Mike Beckerle <[email protected]> > *Sent:* Wednesday, December 1, 2021 4:06 PM > *To:* [email protected] > *Subject:* [EXT] Re: Huh? Nillable complex type elements can only have > '%ES;' as their dfdl:nilValue property > > > > This is definitely a DFDL language restriction, not a Daffodil-specific > thing. > > > > I have made inquiries as to what the rationale is for this restriction, > and I'll report back. > > > > In the mean time, maybe this sort of technique. > > > > <choice> > > <element name="noValue" type="xs:string" dfdl:lengthKind="explicit" > dfdl:length="0" dfdl:initiator="-"/> > > <element name="myComplexType"> > > .... non nillable complex type definition .... > > </element> > > </choice> > > > > I have to admit that this workaround sort of suggests that there isn't a > coherent rationale for the restriction, as this is pretty obviously > equivalent to the complex type being nillable with nilValue="-". > > > > > > On Wed, Dec 1, 2021 at 12:43 PM Roger L Costello <[email protected]> > wrote: > > Hi Folks, > > I am creating a DFDL schema for a data format that has a field whose value > is a hyphen when no data is available and when data is available, then the > field contains either an ISO datetime or a 3-letter month name. Here's how > I specified the field: > > <xs:element name="MyField" nillable="true" dfdl:nilValue="-"> > <xs:complexType> > <xs:choice dfdl:choiceLengthKind="implicit"> > <xs:element name="DateTimeIso"> > <xs:complexType> > <xs:sequence> > ... > </xs:sequence> > </xs:complexType> > </xs:element> > <xs:element name="MonthName" type="xs:string" > dfdl:length="3" dfdl:lengthKind="explicit" /> > </xs:choice> > </xs:complexType> > </xs:element> > > When I run it, Daffodil gives this error message: > > [error] Schema Definition Error: Nillable complex type elements can only > have '%ES;' as their dfdl:nilValue property. > > Is that an error in Daffodil? Or, is it an actual DFDL restriction? If the > latter, why is there such a restriction? How do I work around this error? > > /Roger > >
