I think this is a bug related to dfdl:lengthUnits="characters". It works
correctly if I set it to bytes.

Interestingly, I can't reproduce your output, but it only parses a
single character instead of 3 for me, so it's still doing the wrong thing.

The workaround for now is to use dfdl:lengthUnits="bytes" for elements
that have a prefix length.


On 8/27/19 12:46 PM, Costello, Roger L. wrote:
> Hi Steve,
> 
> Here are my default properties:
> 
> <dfdl:format 
>     alignment="1" 
>     alignmentUnits="bytes"  
>     binaryFloatRep="ieee" 
>     binaryNumberRep="binary"  
>     bitOrder="mostSignificantBitFirst"
>     byteOrder="bigEndian"  
>     calendarPatternKind="implicit"
>     choiceLengthKind="implicit"
>     documentFinalTerminatorCanBeMissing="yes" 
>     emptyValueDelimiterPolicy="none"
>     encoding="ISO-8859-1"
>     encodingErrorPolicy="replace" 
>     escapeSchemeRef=""  
>     fillByte="f" 
>     floating="no" 
>     ignoreCase="no" 
>     initiator="" 
>     initiatedContent="no" 
>     leadingSkip="0" 
>     lengthKind="delimited"
>     lengthUnits="characters"  
>     nilKind="literalValue"  
>     nilValueDelimiterPolicy="none"
>     occursCountKind="implicit"
>     outputNewLine="%CR;%LF;"
>     representation="text" 
>     separator=""
>     separatorPosition="infix"
>     separatorSuppressionPolicy="anyEmpty"  
>     sequenceKind="ordered" 
>     terminator=""   
>     textBidi="no" 
>     textNumberCheckPolicy="strict"
>     textNumberPattern="#,##0.###;-#,##0.###" 
>     textNumberRep="standard" 
>     textNumberRounding="explicit"  
>     textNumberRoundingIncrement="0"
>     textNumberRoundingMode="roundUnnecessary" 
>     textOutputMinLength="0" 
>     textPadKind="none" 
>     textStandardBase="10"
>     textStandardDecimalSeparator="."
>     textStandardExponentRep="E"
>     textStandardInfinityRep="Inf"  
>     textStandardNaNRep="NaN"
>     textStandardZeroRep="0" 
>     textStandardGroupingSeparator="," 
>     textTrimKind="none" 
>     trailingSkip="0" 
>     truncateSpecifiedLengthString="no" 
>     utf16Width="fixed" 
> />
> 
> -----Original Message-----
> From: Steve Lawrence <[email protected]> 
> Sent: Tuesday, August 27, 2019 12:41 PM
> To: [email protected]
> Subject: [EXT] Re: Trying to understand lengthKind="prefixed"
> 
> Works for me, so I'd guess this has something to do with a property in 
> dfdl:format. I'm not sure what property could lead to that output though.
> 
> Can you provide the rest of the schema with the dfdl:format?
> 
> On 8/27/19 11:54 AM, Costello, Roger L. wrote:
>> Hello DFDL community,
>>
>> I believe that lengthKind="prefixed" is used when the input data is 
>> prefixed by an integer which indicates the length of the data. For 
>> example, below the data is the string ABC and it is prefixed by the 
>> integer 3
>>
>> 3ABC
>>
>> The 3 indicates that the length of the following data is 3 characters.
>>
>> Do I understand correctly the purpose of lengthKind="prefixed"?
>>
>> Assuming I understand its purpose correctly, why is this DFDL schema failing:
>>
>> <xs:elementname="D"type="xs:string"
>>                          dfdl:lengthKind="prefixed"
>>                          dfdl:prefixLengthType="D-type"
>>                          dfdl:prefixIncludesPrefixLength="no"/>
>>
>> <xs:simpleTypename="D-type"
>>                            dfdl:lengthKind="explicit"
>>                            dfdl:length="1"> 
>> <xs:restrictionbase="xs:integer"/>
>> </xs:simpleType>
>>
>> Here is the error message that I get:
>>
>> *[error] Parse Error: Convert to Unlimited Size Integer (for 
>> xs:integer): Unable to parse 'B' (using up all characters).*
>>
>> What am I doing wrong, please?
>>
>> /Roger
>>
> 

Reply via email to