Assuming your input is plaintext, you could use the dfdl:lengthPattern
attribute:
<xs:element name="value"
type="xs:unsignedInt"
dfdl:lengthKind="pattern"
dfdl:lengthPattern="[0-9]{1,5}"
/>
You could also use lengthKind="delimited" and add an assertion (and/or xsd
restriction) on the value.
________________________________
From: Costello, Roger L. <[email protected]>
Sent: Wednesday, June 19, 2019 9:30:11 AM
To: [email protected]
Subject: How to declare an element of type xs:unsignedInt, restricted to one to
five digit characters?
Hello DFDL community,
The below DFDL schema says that the input must contain a string that represents
an unsignedInt and the string must not contain more than five digit characters.
Eek!
That's not correct. The below DFDL schema says that the input must contain a
string that represents an unsignedInt and the string must contain *exactly*
five digit characters.
Is there a way to write the DFDL schema to specify that the input must contain
a string that represents an unsignedInt and the string must contain *one to
five* digit characters? That is, how to specify that the input could be any of
these strings:
"0", "1", ..., "99999"
<xs:element name="input">
<xs:complexType>
<xs:sequence>
<xs:element name="value"
type="xs:unsignedInt"
dfdl:lengthKind="explicit"
dfdl:length="5"
dfdl:lengthUnits="characters" />
</xs:sequence>
</xs:complexType>
</xs:element>