- The reader starts by reading 3 lines. (recordLine, versionLine and fieldLine)
- If the recordLine is non empty, it check for a leading "filedesc://".
- If the versionLine is non empty, parse and validate the version, reserved and origin fields.
- If the fieldLine is non empty, identify which field version is being used. (Defaults to v1.0 is unidentified)
- If the recordLine is non empty, parse and validate all the record fields, check for errors and update compliance status.
- Checks for valid record length.
- Process payload if present. (V1.1 feature.
- Process payload if present. (V1.1 feature)
The first thing the version block reader does is initialize various internal fields and then read 3 lines from the input stream.
The 3 lines read are (in order): recordLine, versionLine and fieldLine.
Next thing the reader does is to verify that the recordLine starts with "filedesc://" which would identify the beginning of a version block. If this is not the case an error is logged.
The reader checks for a non empty versionLine and proceeds by splitting it up and validating the individual fields.
The fieldLine is fixed for each version. So we compare the line and decide which field scheme to use on the following records.
Since the reader now has the version and field information its time to parse the recordLine itself. The recordLine is split into individual fields which are parse and validated according to the field definition (fieldLine).
After the header has been processed errors are checked and the compliance status is updated.
Lastly the reader checks the record length and reports values that are missing or too small. If there is still record data left the remaining data is sent to the payload processor. Any data present is saved in a string value. (v1.1 specification added an xml payload to the version block)
Steps to parsing an ARC record: