Thanks. I hope the insight I gave you regarding "Citations" helps a little. I realize that this is one of the areas that most "out of the box" software solutions have gone their own way on sourcing. Very little is transferable from one program to another in this area.
So your "Coding Question" would be product and source type specific. You will have to either: 1) roll your own sourcing software disconnected from your primary recording program, 2) write extensive and somewhat brittle parsing code to merge the various layouts, 3) Go with a pure GEDCOM based collection and storage program that supports your needs.
I went with #3.