I’m working at cleaning up the way the GEDCOM tags are handled. Most tags are simple tags. But tags under the header have “/HEAD” appended to them so that they can be distinguished from the simple tags. Their meaning in the header is usually different. e.g. SOUR is different than SOUR/HEAD.
Then there are custom tags that start with a “_” that some programs add. Some even use a “SCHEMA” definition in the header that was defined in GEDCOM 5.3 and earlier, but has been removed since then (at least 10 years ago) because it was deemed too complicated to leave in the standard. The nice part of the SCHEMA was that it gives the label to use for the new tag. Technically the SCHEMA tag is no longer valid GEDCOM, but some programs, most notably Family Tree Maker, use it anyway.
In Behold, I allow the custom tags, and append the level-0 structure and the GEDCOM number to it, because the same custom tag may be used under multiple structures and differently in different GEDCOMs. e.g. _FA1/INDI/1, _FA1/FAM/1, etc.
Basically, this is the way Behold has handled GEDCOM tags for a long time. I think it still needs to do be done at this level, so that you can specify the label to print and turn on or off the display of these tags.
But the way I’ve been handling it is to look for the the 3-level tag first, the 2-level tag second, and the simple tag third. I’ve found this takes a lot of processing because these lookups can be done millions of times. Instead, I decided to redefine the tag to the level it requires when reading the file in. Then the millions of lookups are one-step procedures instead of 3-step. This processing change has reduced Behold’s processing time by a full 10% so that was well worthwhile. Even so, I expect some more speed improvements this version.