This is the second part of the post “ADIF Parser in Python“ - therefore, if you have not read that post you should start there. This picks up and adds ADIX support to our parser and does so in a manner that requires no change (but we make a few for convenience) to the original parser. It also does not require any change to the actual ADIF validation or importing processes.
The code presented here could greatly benefit from being a class or using nested functions as it would eliminate the horrible use of globals but I wanted to keep with using a simple procedural style to be easy to understand and follow along. Those who use OO or understand nested functions can easily alter this code to use those paradigms. The complete source for the resulting parser will be provided as a link at the end of this post.
Our goals for this post are:
- Add ADIX (XML-based ADIF) parsing to our existing parser
- Change no code (or as little as possible) of our original parser
- Share all validation and import processes between the two formats