beanio is stripping empty spaces for fixed length string

972 views
Skip to first unread message

dav...@gmail.com

unread,
Jun 7, 2013, 4:20:59 PM6/7/13
to bea...@googlegroups.com
Hi, Kevin,

I have a field defined in mapping.xml as below

<field length="1" maxOccurs="1" minOccurs="1" name="status"/>

It does allow different status characters including " ". However, after running beanio unmarshal, I see the space is stripped. Can we work around it or any patch you will recommend? Unmarshalling fixed length string is not supposed to behave as xml element, because " " can represent a real value.

Please advise.

-Lei

dav...@gmail.com

unread,
Jun 7, 2013, 5:21:29 PM6/7/13
to bea...@googlegroups.com
BTW, I did tried attribute trim="false", but unmarshaller still stripped the empty string.

Kevin

unread,
Jun 7, 2013, 9:29:00 PM6/7/13
to bea...@googlegroups.com
Hi Lei,

By default, padding is removed for any padded field, and all fixed length fields are considered padded.  To disable this during unmarshaling, set keepPadding="true" on your field definition.

Thanks,
Kevin

dav...@gmail.com

unread,
Jun 7, 2013, 10:03:44 PM6/7/13
to bea...@googlegroups.com
It works. Nice!!! It's better to include this attribute in the reference document.

Thanks Kevin
Reply all
Reply to author
Forward
0 new messages