Fix ISO 8211 concatenated array descriptor parsing with leader subfields#3
Merged
Merged
Conversation
ParseSubfieldLabels only split on '!' delimiter, so label strings like 'VCID*YCOO!XCOO!ZCOO' merged VCID and YCOO into a single name. This broke S-101 MultiPoint (C3IL) records and any concatenated array field with leader + repeating subfields separated by '*'. Add handling for mid-string '*' in ParseSubfieldLabels to correctly split leader subfield names from repeating subfield names per ISO 8211 §6.4.3.3. Also fix a GroupCount double-counting bug in Iso8211FieldReader when RepeatingSubfieldStartIndex > 0: the first repeating group was counted both at entry and at wrap-around. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ParseSubfieldLabelsonly splits on!delimiters, so concatenated array label strings likeVCID*YCOO!XCOO!ZCOOmergedVCIDandYCOOinto a single name (VCID*YCOO). This produced 3 subfield definitions instead of 4, withRepeatingSubfieldStartIndex = -1.This breaks S-101 MultiPoint (C3IL) records and any ISO 8211 concatenated array field using leader + repeating subfields separated by
*(per ISO 8211 §6.4.3.3).Fix
Iso8211DataDescriptiveRecordReader.cs— InParseSubfieldLabels, add handling for mid-string*to splitVCID*YCOOinto two names:VCID(leader, index 0) andYCOO(repeating start, index 1). The existing*-at-start handling for vector-style fields is preserved.Iso8211FieldReader.cs— Fix aGroupCountdouble-counting bug whenRepeatingSubfieldStartIndex > 0: the first repeating group was counted both at entry (set to 1) and at wrap-around (incremented). Changed initial value to 0 so wrap-around correctly produces the count.Tests
RepeatingSubfieldStartIndex = 1*YCOO!XCOOstill works correctlyGetFixedSubfield,GroupCount, andGetSubfieldGroups