Hello DFDL community,
My binary input file contains: string null(s) string null(s) ....
The following DFDL schema correctly parses the input file:
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:string" maxOccurs="unbounded"
dfdl:lengthKind="pattern"
dfdl:lengthPattern="[\x00-\xFF]+?(?=\x00([^\x00]|$))"
dfdl:representation="text"
dfdl:encoding="ISO-8859-1"
dfdl:textTrimKind="padChar"
dfdl:textStringPadCharacter="%NUL;"
dfdl:textStringJustification="left"
dfdl:terminator="%NUL;"/>
</xs:sequence>
</xs:complexType>
</xs:element>
But why do I need dfdl:lengthPattern?
Why can't I simply state this: the input contains an unbounded number of
strings, each string is padded by one or more nulls or ends at the end-of-file.
Why can't I throw out dfdl:lengthPattern and set dfdl:lengthKind to
"delimited"? Why doesn't the following work correctly?
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element name="string" type="xs:string" maxOccurs="unbounded"
dfdl:lengthKind="delimited"
dfdl:representation="text"
dfdl:encoding="ISO-8859-1"
dfdl:textTrimKind="padChar"
dfdl:textStringPadCharacter="%NUL;"
dfdl:textStringJustification="left"
dfdl:terminator="%NUL;"/>
</xs:sequence>
</xs:complexType>
</xs:element>
/Roger