Not quite. type="xs:int" and dfdl:length="4" just means that you have 4
text characters that represent an integer. There are plenty of ways that
4 characters can represent an integer other than 4 numeric digits. For
example:

dfdl:textNumberPattern="0,00" (grouping separator required with two
digits per group)

  "1,23" parses to <num>123</num>

dfdl:textNumberPattern="0E00" (scientific notation)

  "1E05" parses to <num>100000</num>

dfdl:textNumberPattern="X:00" (two digit number preceded by "X:")

  "X:12" parses to <num>12</num>

These all have a length of four and represent an integer, but none of
them represent a 4 digit number. So just because the length of a text
integer is 4 characters, it does not necessarily mean that those four
character must be digits. The textNumberPattern determines how to
interpret those characters and convert them to an integer, and your
pattern of #### says the four characters must be digits.


On 6/24/19 9:13 AM, Costello, Roger L. wrote:
> Hello DFDL community,
> 
> My input contains 4 digits, representing a year. The below DFDL schema seems 
> to 
> do the job. However, it occurs to me that there is a redundancy. If I specify 
> type="xs:int" and dfdl:length="4", then that means the input must contain 
> exactly 4 digits, right? And therefore dfdl:textNumberCheckPolicy="strict" 
> and 
> dfdl:textNumberPattern="####" are redundant, right?  /Roger
> 
> <xs:elementname="Year"
>              type="xs:int"
>              dfdl:length="4"
>              dfdl:lengthKind="explicit"
>              dfdl:textNumberCheckPolicy="strict"
>              dfdl:textNumberPattern="####"/>
> 

Reply via email to