Tuesday, September 19, 2006

Optional Fields in FF Schema

My tryst with FF Schema continues. In this edition it is the optional field settings that I will be tackling. I have a positional file with following structure.

A 123 456 789
B 735 323 456
C 824 359 531

A occurs 1 to unbounded
B occurs 0 to unbounded
C occurs 0 to unbounded

For optional group (B and C) I created a delimited level and made nillable = "true" and minoccurs ="0". I did same settings for positional group. I am not sure if it required at both levels so I did as a safety measure.

Now for some reasons, C started acting like an optional record but NOT B. I tried playing around with delimiter settings etc but nothing worked. Then I thought of change parser optimization property at root element. Default is "speed" and I changed it to "complexity" and bingo it worked. It seems that default parser setting did not recognize Min occurs ="0". But it is strange as it worked for C level.

I Googled the issue and I found out that people faced the same issue and did what I did. If only, I would have seen these sites before. I would have saved a DAY!