I need to parse some files and I'm using a beanio xml file to map out the file to an object. The issue is some files have less characters than others which causes an invalid record type error when unmarshalling. I tried setting minOccurs="0"
for all the optional values but that still returns the same error. Is there a way around this?
This is what my optional fields look like in my record
<field name="optional_field" minOccurs="0" length="5" trim="true"/>
EDIT: The stream:
<stream name="StreamFile" format="fixedlength" ignoreUnidentifiedRecords="true">
The total record length is 441. Some files that are less than that run fine and are processed. But for some reason other files that also have less characters keep throwing that error where it's expecting one of the fields.
EDIT 2: So the reason some files fail and some pass is because some files will partially fill out one of the optional fields, but not to the expected length. So an error is thrown. For example, file length is 99 characters but one of the optional fields has a length of 3 from 98-100. So since its missing that last expected character it throws an error. I tried adding min and max length but it throws an error that it expects a length
value since the stream is fixedLength type