Use Gedcom_val for the xref in the record start callback too.
[gedcom-parse.git] / gedcom / gedcom.y
index 3765b7b25090f090bebba66c6f641ebec5a3f350..872be1271cf9eec23b6adb96334dad6ec01814b1 100644 (file)
 #include "multilex.h"
 #include "encoding.h"
 #include "interface.h"
+#include "date.h"
 
 int  count_level    = 0;
 int  fail           = 0;
@@ -152,6 +153,7 @@ int  compat_enabled = 1;
 int  gedcom_high_level_debug = 0; 
 int  compatibility  = 0; 
 Gedcom_err_mech error_mechanism = IMMED_FAIL;
+Gedcom_val_struct val; 
  
 char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1];
 char *line_item_buf_ptr;
@@ -197,7 +199,7 @@ int  compat_mode(int flags);
 #define CHK(TAG)                                                              \
      { if (!check_occurrence(TAG_##TAG)) {                                    \
          char* parenttag = get_parenttag();                                   \
-         gedcom_error("The tag '%s' is mandatory within '%s', but missing",   \
+         gedcom_error(_("The tag '%s' is mandatory within '%s', but missing"),\
                      #TAG, parenttag);                                       \
          HANDLE_ERROR;                                                        \
        }                                                                      \
@@ -219,20 +221,19 @@ int  compat_mode(int flags);
      { int num = count_tag(TAG_##CHILDTAG);                                   \
        if (num > MAX) {                                                       \
          char* parenttag = get_parenttag();                                   \
-         gedcom_error("The tag '%s' can maximally occur %d "                  \
-                     "time(s) within '%s'",                                  \
+         gedcom_error(_("The tag '%s' can maximally occur %d time(s) within '%s'"),                                                                          \
                      #CHILDTAG, MAX, parenttag);                             \
          HANDLE_ERROR;                                                        \
        }                                                                      \
      }
 #define INVALID_TAG(CHILDTAG)                                                 \
      { char* parenttag = get_parenttag();                                     \
-       gedcom_error("The tag '%s' is not a valid tag within '%s'",            \
+       gedcom_error(_("The tag '%s' is not a valid tag within '%s'"),         \
                    CHILDTAG, parenttag);                                     \
        HANDLE_ERROR;                                                          \
      }
 #define INVALID_TOP_TAG(CHILDTAG)                                             \
-     { gedcom_error("The tag '%s' is not a valid top-level tag",              \
+     { gedcom_error(_("The tag '%s' is not a valid top-level tag"),           \
                    CHILDTAG); \
        HANDLE_ERROR; \
      }
@@ -396,6 +397,12 @@ int  compat_mode(int flags);
 %type <string> anychar
 %type <string> opt_xref
 %type <string> opt_value
+%type <string> opt_line_item
+%type <string> fam_event_tag
+%type <string> indiv_attr_tag
+%type <string> indiv_birt_tag
+%type <string> indiv_gen_tag
+%type <string> lio_bapl_tag
 %type <ctxt> head_sect
 
 %%
@@ -423,7 +430,7 @@ record      : fam_rec
 /**** Header                                                      ****/
 /*********************************************************************/
 head_sect    : OPEN DELIM TAG_HEAD
-               { $<ctxt>$ = start_record(REC_HEAD, $1, NULL, $3);
+               { $<ctxt>$ = start_record(REC_HEAD, $1, GEDCOM_MAKE_NULL(), $3);
                 START(HEAD, $<ctxt>$) }
                head_subs
                { if (compat_mode(C_FTREE))
@@ -458,7 +465,8 @@ head_sub     : head_sour_sect  { OCCUR2(SOUR, 1, 1) }
 head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item 
                  { set_compatibility($4);
                   $<ctxt>$ = start_element(ELT_HEAD_SOUR, PARENT,
-                                           $1, $3, $4, $4);
+                                           $1, $3, $4,
+                                           GEDCOM_MAKE_STRING($4));
                   START(SOUR, $<ctxt>$)
                 }
                  head_sour_subs
@@ -480,7 +488,8 @@ head_sour_sub : head_sour_vers_sect  { OCCUR2(VERS, 0, 1) }
 
 head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
                       { $<ctxt>$ = start_element(ELT_HEAD_SOUR_VERS, PARENT,
-                                                $1, $3, $4, $4);
+                                                $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
                        START(VERS, $<ctxt>$)
                      }
                       no_std_subs
@@ -492,7 +501,8 @@ head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item
                     ;
 head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
                       { $<ctxt>$ = start_element(ELT_HEAD_SOUR_NAME, PARENT,
-                                                $1, $3, $4, $4);
+                                                $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
                        START(NAME, $<ctxt>$)
                      }
                       no_std_subs
@@ -504,7 +514,8 @@ head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item
                     ;
 head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item 
                       { $<ctxt>$ = start_element(ELT_HEAD_SOUR_CORP, PARENT,
-                                                $1, $3, $4, $4);
+                                                $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
                        START(CORP, $<ctxt>$)
                      }
                       head_sour_corp_subs
@@ -525,7 +536,8 @@ head_sour_corp_sub : addr_struc_sub  /* 0:1 */
 
 head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item 
                       { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA, PARENT,
-                                                $1, $3, $4, $4);
+                                                $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
                        START(DATA, $<ctxt>$)
                      }
                       head_sour_data_subs
@@ -546,8 +558,10 @@ head_sour_data_sub : head_sour_data_date_sect  { OCCUR2(DATE, 0, 1) }
                    ;
 
 head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
-                           { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
-                                                     PARENT, $1, $3, $4, $4);
+                           { struct date_value dv = gedcom_parse_date($4);
+                            $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_DATE,
+                                                     PARENT, $1, $3, $4, 
+                                                     GEDCOM_MAKE_DATE(dv));
                             START(DATE, $<ctxt>$)
                           }
                            no_std_subs
@@ -559,7 +573,8 @@ head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item
                          ;
 head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
                            { $<ctxt>$ = start_element(ELT_HEAD_SOUR_DATA_COPR,
-                                                     PARENT, $1, $3, $4, $4);
+                                                     PARENT, $1, $3, $4, 
+                                                     GEDCOM_MAKE_STRING($4));
                             START(COPR, $<ctxt>$)
                           }
                            no_std_subs
@@ -573,7 +588,8 @@ head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item
 /* HEAD.DEST */
 head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
                  { $<ctxt>$ = start_element(ELT_HEAD_DEST,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(DEST, $<ctxt>$)
                 }
                  no_std_subs
@@ -586,8 +602,10 @@ head_dest_sect : OPEN DELIM TAG_DEST mand_line_item
 
 /* HEAD.DATE */
 head_date_sect : OPEN DELIM TAG_DATE mand_line_item 
-                 { $<ctxt>$ = start_element(ELT_HEAD_DATE,
-                                           PARENT, $1, $3, $4, $4);
+                 { struct date_value dv = gedcom_parse_date($4);
+                  $<ctxt>$ = start_element(ELT_HEAD_DATE,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_DATE(dv));
                   START(DATE, $<ctxt>$)
                 }
                  head_date_subs
@@ -608,7 +626,8 @@ head_date_sub  : head_date_time_sect  { OCCUR2(TIME, 0, 1) }
 
 head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
                       { $<ctxt>$ = start_element(ELT_HEAD_DATE_TIME,
-                                                PARENT, $1, $3, $4, $4);
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
                        START(TIME, $<ctxt>$)
                      }
                       no_std_subs
@@ -622,7 +641,8 @@ head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
 /* HEAD.SUBM */
 head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
                  { $<ctxt>$ = start_element(ELT_HEAD_SUBM,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(SUBM, $<ctxt>$)
                 }
                  no_std_subs
@@ -635,7 +655,8 @@ head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
 /* HEAD.SUBN */
 head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer 
                  { $<ctxt>$ = start_element(ELT_HEAD_SUBN,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(SUBN, $<ctxt>$)
                 }
                  no_std_subs
@@ -648,7 +669,8 @@ head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer
 /* HEAD.FILE */
 head_file_sect : OPEN DELIM TAG_FILE mand_line_item 
                  { $<ctxt>$ = start_element(ELT_HEAD_FILE,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(FILE, $<ctxt>$)
                 }
                  no_std_subs
@@ -660,7 +682,8 @@ head_file_sect : OPEN DELIM TAG_FILE mand_line_item
 /* HEAD.COPR */
 head_copr_sect : OPEN DELIM TAG_COPR mand_line_item 
                  { $<ctxt>$ = start_element(ELT_HEAD_COPR,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(COPR, $<ctxt>$)
                 }
                  no_std_subs
@@ -672,7 +695,8 @@ head_copr_sect : OPEN DELIM TAG_COPR mand_line_item
 /* HEAD.GEDC */
 head_gedc_sect : OPEN DELIM TAG_GEDC
                  { $<ctxt>$ = start_element(ELT_HEAD_GEDC,
-                                           PARENT, $1, $3, NULL, NULL);
+                                           PARENT, $1, $3, NULL,
+                                           GEDCOM_MAKE_NULL());
                   START(GEDC, $<ctxt>$)
                 }
                  head_gedc_subs
@@ -692,7 +716,8 @@ head_gedc_sub  : head_gedc_vers_sect  { OCCUR2(VERS, 1, 1) }
                ;
 head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item  
                       { $<ctxt>$ = start_element(ELT_HEAD_GEDC_VERS,
-                                                PARENT, $1, $3, $4, $4);
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
                        START(VERS, $<ctxt>$)
                      }
                       no_std_subs
@@ -704,7 +729,8 @@ head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item
                     ;
 head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item   
                       { $<ctxt>$ = start_element(ELT_HEAD_GEDC_FORM,
-                                                PARENT, $1, $3, $4, $4);
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
                        START(FORM, $<ctxt>$)
                      }
                       no_std_subs
@@ -719,7 +745,8 @@ head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item
 head_char_sect : OPEN DELIM TAG_CHAR mand_line_item 
                  { if (open_conv_to_internal($4) == 0) YYERROR;
                   $<ctxt>$ = start_element(ELT_HEAD_CHAR,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(CHAR, $<ctxt>$)
                 }
                  head_char_subs
@@ -738,7 +765,8 @@ head_char_sub  : head_char_vers_sect  { OCCUR2(VERS, 0, 1) }
                ;
 head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item   
                       { $<ctxt>$ = start_element(ELT_HEAD_CHAR_VERS,
-                                                PARENT, $1, $3, $4, $4);
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
                        START(VERS, $<ctxt>$)
                      }
                       no_std_subs
@@ -752,7 +780,8 @@ head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item
 /* HEAD.LANG */
 head_lang_sect : OPEN DELIM TAG_LANG mand_line_item   
                  { $<ctxt>$ = start_element(ELT_HEAD_LANG,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(LANG, $<ctxt>$)
                 }
                  no_std_subs
@@ -764,7 +793,8 @@ head_lang_sect : OPEN DELIM TAG_LANG mand_line_item
 /* HEAD.PLAC */
 head_plac_sect : OPEN DELIM TAG_PLAC
                  { $<ctxt>$ = start_element(ELT_HEAD_PLAC,
-                                           PARENT, $1, $3, NULL, NULL);
+                                           PARENT, $1, $3, NULL,
+                                           GEDCOM_MAKE_NULL());
                   START(PLAC, $<ctxt>$)
                 }
                  head_plac_subs
@@ -783,7 +813,8 @@ head_plac_sub  : head_plac_form_sect  { OCCUR2(FORM, 1, 1) }
                ;
 head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item   
                       { $<ctxt>$ = start_element(ELT_HEAD_PLAC_FORM,
-                                                PARENT, $1, $3, $4, $4);
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
                        START(FORM, $<ctxt>$)
                      }
                       no_std_subs
@@ -797,7 +828,8 @@ head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item
 /* HEAD.NOTE */
 head_note_sect : OPEN DELIM TAG_NOTE mand_line_item 
                  { $<ctxt>$ = start_element(ELT_HEAD_NOTE,
-                                           PARENT, $1, $3, $4, $4);
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
                   START(NOTE, $<ctxt>$)
                 }
                  head_note_subs
@@ -826,7 +858,8 @@ trlr_sect   : OPEN DELIM TAG_TRLR CLOSE { }
 /**** Family record                                               ****/
 /*********************************************************************/
 fam_rec      : OPEN DELIM POINTER DELIM TAG_FAM
-               { $<ctxt>$ = start_record(REC_FAM, $1, $3, $5);
+               { $<ctxt>$ = start_record(REC_FAM,
+                                        $1, GEDCOM_MAKE_STRING($3), $5);
                 START(FAM, $<ctxt>$) }
                fam_subs
               { CHECK0 }
@@ -855,39 +888,80 @@ fam_sub      : fam_event_struc_sub  /* 0:M */
 
 /* FAM.HUSB */
 fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer    
-                { START(HUSB, NULL) } no_std_subs { CHECK0 } CLOSE
-                       { }
+                { $<ctxt>$ = start_element(ELT_FAM_HUSB,
+                                          PARENT, $1, $3, $4, 
+                                          GEDCOM_MAKE_STRING($4));
+                 START(HUSB, $<ctxt>$)
+               }
+                no_std_subs
+                { CHECK0 }
+                CLOSE
+                { end_element(ELT_FAM_HUSB, PARENT, $<ctxt>5, NULL);
+               }
               ;
 
 /* FAM.WIFE */
 fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer 
-                { START(WIFE, NULL) } no_std_subs { CHECK0 } CLOSE
-                       { }
+                { $<ctxt>$ = start_element(ELT_FAM_WIFE,
+                                          PARENT, $1, $3, $4, 
+                                          GEDCOM_MAKE_STRING($4));
+                 START(WIFE, $<ctxt>$)
+               }
+                no_std_subs
+                { CHECK0 }
+                CLOSE
+                { end_element(ELT_FAM_WIFE, PARENT, $<ctxt>5, NULL);
+               }
               ;
 
 /* FAM.CHIL */
 fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer
-                { START(CHIL, NULL) } no_std_subs { CHECK0 } CLOSE
-                       { }
+                { $<ctxt>$ = start_element(ELT_FAM_CHIL,
+                                          PARENT, $1, $3, $4, 
+                                          GEDCOM_MAKE_STRING($4));
+                 START(CHIL, $<ctxt>$) 
+               } 
+               no_std_subs 
+               { CHECK0 } 
+               CLOSE
+                { end_element(ELT_FAM_CHIL, PARENT, $<ctxt>5, NULL);
+               }
               ;
 
 /* FAM.NCHI */
 fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item    
-                { START(NCHI, NULL) } no_std_subs { CHECK0 } CLOSE
-                       { }
+                { $<ctxt>$ = start_element(ELT_FAM_NCHI,
+                                          PARENT, $1, $3, $4, 
+                                          GEDCOM_MAKE_STRING($4));
+                 START(NCHI, $<ctxt>$)  
+               }  
+               no_std_subs  
+               { CHECK0 }  
+               CLOSE
+                { end_element(ELT_FAM_NCHI, PARENT, $<ctxt>5, NULL);
+               }
               ;
 
 /* FAM.SUBM */
 fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
-                { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE
-                       { }
+                { $<ctxt>$ = start_element(ELT_FAM_SUBM,
+                                          PARENT, $1, $3, $4, 
+                                          GEDCOM_MAKE_STRING($4));
+                 START(SUBM, $<ctxt>$)   
+               }   
+               no_std_subs   
+               { CHECK0 }   
+               CLOSE
+                { end_element(ELT_FAM_SUBM, PARENT, $<ctxt>5, NULL);
+               }
               ;
 
 /*********************************************************************/
 /**** Individual record                                           ****/
 /*********************************************************************/
 indiv_rec   : OPEN DELIM POINTER DELIM TAG_INDI
-              { $<ctxt>$ = start_record(REC_INDI, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_INDI,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(INDI, $<ctxt>$) }
               indi_subs
              { CHECK0 }
@@ -927,42 +1001,114 @@ indi_sub    : indi_resn_sect  { OCCUR2(RESN, 0, 1) }
 
 /* INDI.RESN */
 indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item     
-                 { START(RESN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_RESN,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(RESN, $<ctxt>$)    
+                }    
+                no_std_subs     
+                { CHECK0 }     
+                CLOSE     
+                { end_element(ELT_INDI_RESN, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.SEX */
 indi_sex_sect  : OPEN DELIM TAG_SEX mand_line_item     
-                 { START(SEX, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_SEX,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(SEX, $<ctxt>$)     
+                }     
+                no_std_subs     
+                { CHECK0 }     
+                CLOSE     
+                { end_element(ELT_INDI_SEX, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.SUBM */
 indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer 
-                 { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_SUBM,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(SUBM, $<ctxt>$)      
+                }      
+                no_std_subs      
+                { CHECK0 }      
+                CLOSE      
+                { end_element(ELT_INDI_SUBM, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.ALIA */
 indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer
-                 { START(ALIA, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_ALIA,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(ALIA, $<ctxt>$)       
+                }       
+                no_std_subs       
+                { CHECK0 }       
+                CLOSE       
+                { end_element(ELT_INDI_ALIA, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.ANCI */
 indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer
-                 { START(ANCI, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_ANCI,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(ANCI, $<ctxt>$)        
+                }        
+                no_std_subs        
+                { CHECK0 }        
+                CLOSE        
+                { end_element(ELT_INDI_ANCI, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.DESI */
 indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer
-                 { START(DESI, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_DESI,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(DESI, $<ctxt>$)         
+                }         
+                no_std_subs         
+                { CHECK0 }         
+                CLOSE         
+                { end_element(ELT_INDI_DESI, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.RFN */
 indi_rfn_sect  : OPEN DELIM TAG_RFN mand_line_item     
-                 { START(RFN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_RFN,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(RFN, $<ctxt>$)          
+                }          
+                no_std_subs          
+                { CHECK0 }          
+                CLOSE          
+                { end_element(ELT_INDI_RFN, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.AFN */
 indi_afn_sect  : OPEN DELIM TAG_AFN mand_line_item      
-                 { START(AFN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_INDI_AFN,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(AFN, $<ctxt>$)           
+                }           
+                no_std_subs           
+                { CHECK0 }           
+                CLOSE           
+                { end_element(ELT_INDI_AFN, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* INDI.ADDR (Only for 'ftree' compatibility) */
@@ -973,7 +1119,8 @@ ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item
 /**** Multimedia record                                           ****/
 /*********************************************************************/
 multim_rec  : OPEN DELIM POINTER DELIM TAG_OBJE
-              { $<ctxt>$ = start_record(REC_OBJE, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_OBJE,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(OBJE, $<ctxt>$) }
               obje_subs
              { CHECK2(FORM, BLOB) }
@@ -997,20 +1144,44 @@ obje_sub    : obje_form_sect  { OCCUR2(FORM, 1, 1) }
 
 /* OBJE.FORM */
 obje_form_sect : OPEN DELIM TAG_FORM mand_line_item       
-                 { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_OBJE_FORM,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(FORM, $<ctxt>$)            
+                }            
+                no_std_subs            
+                { CHECK0 }            
+                CLOSE            
+                { end_element(ELT_OBJE_FORM, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* OBJE.TITL */
 obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item       
-                 { START(TITL, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_OBJE_TITL,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(TITL, $<ctxt>$)             
+                }             
+                no_std_subs             
+                { CHECK0 }             
+                CLOSE             
+                { end_element(ELT_OBJE_TITL, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* OBJE.BLOB */
 obje_blob_sect : OPEN DELIM TAG_BLOB
-                 { START(BLOB, NULL) }
+                 { $<ctxt>$ = start_element(ELT_OBJE_BLOB,
+                                           PARENT, $1, $3, NULL,
+                                           GEDCOM_MAKE_NULL());
+                  START(BLOB, $<ctxt>$)              
+                }
                  obje_blob_subs
                 { CHECK1(CONT) }
-                 CLOSE { }
+                 CLOSE              
+                { end_element(ELT_OBJE_BLOB, PARENT, $<ctxt>4, NULL);
+                }
                ;
 
 obje_blob_subs : /* empty */
@@ -1022,19 +1193,39 @@ obje_blob_sub  : obje_blob_cont_sect  { OCCUR1(CONT, 1) }
                ;
 
 obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item        
-                      { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_OBJE_BLOB_CONT,
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
+                       START(CONT, $<ctxt>$)               
+                     }                
+                     no_std_subs                
+                     { CHECK0 }                
+                     CLOSE                
+                     { end_element(ELT_OBJE_BLOB_CONT, PARENT,
+                                   $<ctxt>5, NULL);
+                     }
                     ;
 
 /* OBJE.OBJE */
 obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer 
-                 { START(OBJE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_OBJE_OBJE,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(OBJE, $<ctxt>$)  
+                 }  
+                 no_std_subs  
+                 { CHECK0 }  
+                 CLOSE  
+                 { end_element(ELT_OBJE_OBJE, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /*********************************************************************/
 /**** Note record                                                 ****/
 /*********************************************************************/
 note_rec    : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
-              { $<ctxt>$ = start_record(REC_NOTE, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_NOTE,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(NOTE, $<ctxt>$) }
               note_subs
              { CHECK0 }
@@ -1044,11 +1235,11 @@ note_rec    : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item
 
 note_line_item : /* empty */
                    { if (!compat_mode(C_FTREE)) {
-                      gedcom_error("Missing value"); YYERROR;
+                      gedcom_error(_("Missing value")); YYERROR;
                     }
                   }
                | DELIM line_item
-                   { gedcom_debug_print("==Val: %s==\n", $2);
+                   { gedcom_debug_print("==Val: %s==", $2);
                     $$ = $2; }
                ;
 
@@ -1067,7 +1258,8 @@ note_sub    : continuation_sub  /* 0:M */
 /**** Repository record                                           ****/
 /*********************************************************************/
 repos_rec   : OPEN DELIM POINTER DELIM TAG_REPO
-              { $<ctxt>$ = start_record(REC_REPO, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_REPO,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(REPO, $<ctxt>$) }
               repo_subs
              { CHECK0 }
@@ -1089,14 +1281,24 @@ repo_sub    : repo_name_sect  { OCCUR2(NAME, 0, 1) }
 
 /* REPO.NAME */
 repo_name_sect : OPEN DELIM TAG_NAME mand_line_item         
-                 { START(NAME, NULL) } no_std_subs { CHECK0 } CLOSE {}
+                 { $<ctxt>$ = start_element(ELT_REPO_NAME,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(NAME, $<ctxt>$)          
+                 }          
+                 no_std_subs          
+                 { CHECK0 }          
+                 CLOSE          
+                 { end_element(ELT_REPO_NAME, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /*********************************************************************/
 /**** Source record                                               ****/
 /*********************************************************************/
 source_rec  : OPEN DELIM POINTER DELIM TAG_SOUR
-              { $<ctxt>$ = start_record(REC_SOUR, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_SOUR,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(SOUR, $<ctxt>$) }
               sour_subs
              { CHECK0 }
@@ -1124,10 +1326,16 @@ sour_sub    : sour_data_sect  { OCCUR2(DATA, 0, 1) }
 
 /* SOUR.DATA */
 sour_data_sect : OPEN DELIM TAG_DATA
-                 { START(DATA, NULL) }
+                 { $<ctxt>$ = start_element(ELT_SOUR_DATA,
+                                           PARENT, $1, $3, NULL,
+                                           GEDCOM_MAKE_NULL());
+                  START(DATA, $<ctxt>$) 
+                 }
                  sour_data_subs
                 { CHECK0 }
-                 CLOSE { }
+                 CLOSE 
+                 { end_element(ELT_SOUR_DATA, PARENT, $<ctxt>4, NULL);
+                }
                ;
 
 sour_data_subs : /* empty */
@@ -1141,10 +1349,17 @@ sour_data_sub  : sour_data_even_sect  /* 0:M */
                ;
 
 sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item 
-                      { START(EVEN, NULL) }
+                      { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN,
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
+                       START(EVEN, $<ctxt>$)  
+                      }
                       sour_data_even_subs
                      { CHECK0 }
-                      CLOSE { }
+                      CLOSE  
+                      { end_element(ELT_SOUR_DATA_EVEN, PARENT,
+                                   $<ctxt>5, NULL);
+                     }
                     ;
 
 sour_data_even_subs : /* empty */
@@ -1157,23 +1372,60 @@ sour_data_even_sub  : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) }
                     ;
 
 sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item          
-                           { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                           { struct date_value dv = gedcom_parse_date($4);
+                            $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_DATE,
+                                                     PARENT, $1, $3, $4, 
+                                                     GEDCOM_MAKE_DATE(dv));
+                            START(DATE, $<ctxt>$)           
+                           }           
+                           no_std_subs           
+                           { CHECK0 }           
+                           CLOSE           
+                           { end_element(ELT_SOUR_DATA_EVEN_DATE, PARENT,
+                                        $<ctxt>5, NULL);
+                          }
                          ;
 
 sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item          
-                           { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                           { $<ctxt>$ = start_element(ELT_SOUR_DATA_EVEN_PLAC,
+                                                     PARENT, $1, $3, $4, 
+                                                     GEDCOM_MAKE_STRING($4));
+                            START(PLAC, $<ctxt>$)           
+                           }           
+                           no_std_subs           
+                           { CHECK0 }           
+                           CLOSE           
+                           { end_element(ELT_SOUR_DATA_EVEN_PLAC, PARENT,
+                                        $<ctxt>5, NULL);
+                          }
                          ;
 
 sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item          
-                      { START(AGNC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_SOUR_DATA_AGNC,
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
+                       START(AGNC, $<ctxt>$)           
+                      }           
+                      no_std_subs           
+                      { CHECK0 }           
+                      CLOSE           
+                      { end_element(ELT_SOUR_DATA_AGNC, PARENT,
+                                   $<ctxt>5, NULL);
+                     }
                     ;
 
 /* SOUR.AUTH */
 sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item
-                 { START(AUTH, NULL) }
+                 { $<ctxt>$ = start_element(ELT_SOUR_AUTH,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(AUTH, $<ctxt>$) 
+                 }
                  sour_auth_subs
                 { CHECK0 }
-                 CLOSE { }
+                 CLOSE 
+                 { end_element(ELT_SOUR_AUTH, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 sour_auth_subs : /* empty */
@@ -1186,10 +1438,16 @@ sour_auth_sub  : continuation_sub  /* 0:M */
 
 /* SOUR.TITL */
 sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item  
-                 { START(TITL, NULL) }
+                 { $<ctxt>$ = start_element(ELT_SOUR_TITL,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(TITL, $<ctxt>$)   
+                 }
                  sour_titl_subs 
                 { CHECK0 }
-                 CLOSE { }
+                 CLOSE   
+                 { end_element(ELT_SOUR_TITL, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 sour_titl_subs : /* empty */
@@ -1202,15 +1460,30 @@ sour_titl_sub  : continuation_sub  /* 0:M */
 
 /* SOUR.ABBR */
 sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item           
-                 { START(ABBR, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SOUR_ABBR,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(ABBR, $<ctxt>$)            
+                 }            
+                 no_std_subs            
+                 { CHECK0 }            
+                 CLOSE            
+                 { end_element(ELT_SOUR_ABBR, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SOUR.PUBL */
 sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item  
-                 { START(PUBL, NULL) }
+                 { $<ctxt>$ = start_element(ELT_SOUR_PUBL,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(PUBL, $<ctxt>$)            
+                 }
                  sour_publ_subs  
                 { CHECK0 }
-                 CLOSE { }
+                 CLOSE            
+                 { end_element(ELT_SOUR_PUBL, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 sour_publ_subs : /* empty */
@@ -1223,10 +1496,16 @@ sour_publ_sub  : continuation_sub  /* 0:M */
 
 /* SOUR.TEXT */
 sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item   
-                 { START(TEXT, NULL) }
+                 { $<ctxt>$ = start_element(ELT_SOUR_TEXT,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(TEXT, $<ctxt>$)    
+                 }
                  sour_text_subs  
                 { CHECK0 }
-                 CLOSE { }
+                 CLOSE    
+                 { end_element(ELT_SOUR_TEXT, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 sour_text_subs : /* empty */
@@ -1241,7 +1520,8 @@ sour_text_sub  : continuation_sub  /* 0:M */
 /**** Submission record                                           ****/
 /*********************************************************************/
 submis_rec  : OPEN DELIM POINTER DELIM TAG_SUBN    
-              { $<ctxt>$ = start_record(REC_SUBN, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_SUBN,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(SUBN, $<ctxt>$) }
               subn_subs
              { CHECK0 }
@@ -1265,44 +1545,108 @@ subn_sub    : subn_subm_sect  { OCCUR2(SUBM, 0, 1) }
 
 /* SUBN.SUBM */
 subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer
-                 { START(SUBM, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBN_SUBM,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(SUBM, $<ctxt>$) 
+                 } 
+                 no_std_subs 
+                 { CHECK0 } 
+                 CLOSE 
+                 { end_element(ELT_SUBN_SUBM, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBN.FAMF */
 subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item            
-                 { START(FAMF, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBN_FAMF,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(FAMF, $<ctxt>$)             
+                 }             
+                 no_std_subs             
+                 { CHECK0 }             
+                 CLOSE             
+                 { end_element(ELT_SUBN_FAMF, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBN.TEMP */
 subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item            
-                 { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBN_TEMP,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(TEMP, $<ctxt>$)             
+                 }             
+                 no_std_subs             
+                 { CHECK0 }             
+                 CLOSE             
+                 { end_element(ELT_SUBN_TEMP, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBN.ANCE */
 subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item            
-                 { START(ANCE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBN_ANCE,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(ANCE, $<ctxt>$)             
+                 }             
+                 no_std_subs             
+                 { CHECK0 }             
+                 CLOSE             
+                 { end_element(ELT_SUBN_ANCE, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBN.DESC */
 subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item            
-                 { START(DESC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBN_DESC,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(DESC, $<ctxt>$)             
+                 }             
+                 no_std_subs             
+                 { CHECK0 }             
+                 CLOSE             
+                 { end_element(ELT_SUBN_DESC, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBN.ORDI */
 subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item            
-                 { START(ORDI, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBN_ORDI,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(ORDI, $<ctxt>$)             
+                 }             
+                 no_std_subs             
+                 { CHECK0 }             
+                 CLOSE             
+                 { end_element(ELT_SUBN_ORDI, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBN.RIN */
 subn_rin_sect  : OPEN DELIM TAG_RIN mand_line_item            
-                 { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBN_RIN,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(RIN, $<ctxt>$)             
+                 }             
+                 no_std_subs             
+                 { CHECK0 }             
+                 CLOSE             
+                 { end_element(ELT_SUBN_RIN, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /*********************************************************************/
 /**** Submitter record                                            ****/
 /*********************************************************************/
 submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM    
-             { $<ctxt>$ = start_record(REC_SUBM, $1, $3, $5);
+             { $<ctxt>$ = start_record(REC_SUBM,
+                                      $1, GEDCOM_MAKE_STRING($3), $5);
                START(SUBM, $<ctxt>$) }
              subm_subs
             { CHECK1(NAME) }
@@ -1326,22 +1670,58 @@ subm_sub   : subm_name_sect  { OCCUR2(NAME, 0, 1) }
 
 /* SUBM.NAME */
 subm_name_sect : OPEN DELIM TAG_NAME mand_line_item             
-                 { START(NAME, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBM_NAME,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(NAME, $<ctxt>$)              
+                 }              
+                 no_std_subs              
+                 { CHECK0 }              
+                 CLOSE              
+                 { end_element(ELT_SUBM_NAME, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBM.LANG */
 subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item             
-                 { START(LANG, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBM_LANG,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(LANG, $<ctxt>$)              
+                 }              
+                 no_std_subs              
+                 { CHECK0 }              
+                 CLOSE              
+                 { end_element(ELT_SUBM_LANG, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBM.RFN */
 subm_rfn_sect  : OPEN DELIM TAG_RFN mand_line_item             
-                 { START(RFN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBM_RFN,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(RFN, $<ctxt>$)              
+                 }              
+                 no_std_subs              
+                 { CHECK0 }              
+                 CLOSE              
+                 { end_element(ELT_SUBM_RFN, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* SUBM.RIN */
 subm_rin_sect  : OPEN DELIM TAG_RIN mand_line_item             
-                 { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUBM_RIN,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(RIN, $<ctxt>$)              
+                 }              
+                 no_std_subs              
+                 { CHECK0 }              
+                 CLOSE              
+                 { end_element(ELT_SUBM_RIN, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /*********************************************************************/
@@ -1354,10 +1734,16 @@ addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) }
                ;
 
 addr_sect   : OPEN DELIM TAG_ADDR mand_line_item 
-              { START(ADDR, NULL) }
+              { $<ctxt>$ = start_element(ELT_SUB_ADDR,
+                                        PARENT, $1, $3, $4, 
+                                        GEDCOM_MAKE_STRING($4));
+               START(ADDR, $<ctxt>$)  
+              }
               addr_subs
              { CHECK0 }
-              CLOSE { }
+              CLOSE  
+              { end_element(ELT_SUB_ADDR, PARENT, $<ctxt>5, NULL);
+             }
             ;
 
 addr_subs   : /* empty */
@@ -1375,29 +1761,101 @@ addr_sub    : addr_cont_sect  /* 0:M */
             ;
 
 addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item              
-                 { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CONT,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(CONT, $<ctxt>$)               
+                 }               
+                 no_std_subs               
+                 { CHECK0 }               
+                 CLOSE               
+                 { end_element(ELT_SUB_ADDR_CONT, PARENT, $<ctxt>5, NULL);
+                }
                ;
 addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item              
-                 { START(ADR1, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR1,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(ADR1, $<ctxt>$)               
+                 }               
+                 no_std_subs               
+                 { CHECK0 }               
+                 CLOSE               
+                 { end_element(ELT_SUB_ADDR_ADR1, PARENT, $<ctxt>5, NULL);
+                }
                ;
 addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item              
-                 { START(ADR2, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ADDR_ADR2,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(ADR2, $<ctxt>$)               
+                 }               
+                 no_std_subs               
+                 { CHECK0 }               
+                 CLOSE               
+                 { end_element(ELT_SUB_ADDR_ADR2, PARENT, $<ctxt>5, NULL);
+                }
                ;
 addr_city_sect : OPEN DELIM TAG_CITY mand_line_item              
-                 { START(CITY, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CITY,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(CITY, $<ctxt>$)               
+                 }               
+                 no_std_subs               
+                 { CHECK0 }               
+                 CLOSE               
+                 { end_element(ELT_SUB_ADDR_CITY, PARENT, $<ctxt>5, NULL);
+                }
                ;
 addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item              
-                 { START(STAE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ADDR_STAE,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(STAE, $<ctxt>$)               
+                 }               
+                 no_std_subs               
+                 { CHECK0 }               
+                 CLOSE               
+                 { end_element(ELT_SUB_ADDR_STAE, PARENT, $<ctxt>5, NULL);
+                }
                ;
 addr_post_sect : OPEN DELIM TAG_POST mand_line_item              
-                 { START(POST, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ADDR_POST,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(POST, $<ctxt>$)               
+                 }               
+                 no_std_subs               
+                 { CHECK0 }               
+                 CLOSE               
+                 { end_element(ELT_SUB_ADDR_POST, PARENT, $<ctxt>5, NULL);
+                }
                ;
 addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item              
-                 { START(CTRY, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ADDR_CTRY,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(CTRY, $<ctxt>$)               
+                 }               
+                 no_std_subs               
+                 { CHECK0 }               
+                 CLOSE               
+                 { end_element(ELT_SUB_ADDR_CTRY, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 phon_sect   : OPEN DELIM TAG_PHON mand_line_item              
-              { START(PHON, NULL) } no_std_subs { CHECK0 } CLOSE { }
+              { $<ctxt>$ = start_element(ELT_SUB_PHON,
+                                        PARENT, $1, $3, $4, 
+                                        GEDCOM_MAKE_STRING($4));
+               START(PHON, $<ctxt>$)               
+              }               
+              no_std_subs               
+              { CHECK0 }               
+              CLOSE               
+              { end_element(ELT_SUB_PHON, PARENT, $<ctxt>5, NULL);
+             }
             ;
 
 /* ASSOCIATION STRUCTURE */
@@ -1405,10 +1863,16 @@ assoc_struc_sub : asso_sect /* 0:M */
                 ;
 
 asso_sect : OPEN DELIM TAG_ASSO mand_pointer
-            { START(ASSO, NULL) }
+            { $<ctxt>$ = start_element(ELT_SUB_ASSO,
+                                      PARENT, $1, $3, $4, 
+                                      GEDCOM_MAKE_STRING($4));
+             START(ASSO, $<ctxt>$) 
+            }
             asso_subs
            { CHECK2(TYPE,RELA) }
-            CLOSE { }
+            CLOSE 
+            { end_element(ELT_SUB_ASSO, PARENT, $<ctxt>5, NULL);
+           }
           ;
 
 asso_subs : /* empty */
@@ -1420,11 +1884,29 @@ asso_subs : /* empty */
           ;
 
 asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item               
-                 { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ASSO_TYPE,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(TYPE, $<ctxt>$)                
+                 }                
+                 no_std_subs                
+                 { CHECK0 }                
+                 CLOSE                
+                 { end_element(ELT_SUB_ASSO_TYPE, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item               
-                 { START(RELA, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_ASSO_RELA,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(RELA, $<ctxt>$)                
+                 }                
+                 no_std_subs                
+                 { CHECK0 }                
+                 CLOSE                
+                 { end_element(ELT_SUB_ASSO_RELA, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* CHANGE DATE */
@@ -1432,10 +1914,16 @@ change_date_sub : change_date_chan_sect  { OCCUR2(CHAN, 0, 1) }
                 ;
 
 change_date_chan_sect : OPEN DELIM TAG_CHAN
-                        { START(CHAN, NULL) }
+                        { $<ctxt>$ = start_element(ELT_SUB_CHAN,
+                                                  PARENT, $1, $3, NULL, 
+                                                  GEDCOM_MAKE_NULL());
+                         START(CHAN, $<ctxt>$) 
+                        }
                         change_date_chan_subs
                        { CHECK1(DATE) }
-                        CLOSE { }
+                        CLOSE 
+                        { end_element(ELT_SUB_CHAN, PARENT, $<ctxt>4, NULL);
+                       }
                       ;
 
 change_date_chan_subs : /* empty */
@@ -1448,10 +1936,17 @@ change_date_chan_sub  : change_date_date_sect  { OCCUR2(DATE, 1, 1) }
                       ;
 
 change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item 
-                        { START(DATE, NULL) }
+                        { struct date_value dv = gedcom_parse_date($4);
+                         $<ctxt>$ = start_element(ELT_SUB_CHAN_DATE,
+                                                  PARENT, $1, $3, $4, 
+                                                  GEDCOM_MAKE_DATE(dv));
+                         START(DATE, $<ctxt>$) }
                         change_date_date_subs
                        { CHECK0 }
-                        CLOSE { }
+                        CLOSE 
+                       { end_element(ELT_SUB_CHAN_DATE, PARENT, $<ctxt>5,
+                                     NULL);
+                       }
                       ;
 
 change_date_date_subs : /* empty */
@@ -1463,7 +1958,18 @@ change_date_date_sub : change_date_date_time_sect  { OCCUR2(TIME, 0, 1) }
                      ;
 
 change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item
-                             { START(TIME, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                             { $<ctxt>$
+                                = start_element(ELT_SUB_CHAN_TIME,
+                                                PARENT, $1, $3, $4, 
+                                                GEDCOM_MAKE_STRING($4));
+                              START(TIME, $<ctxt>$) 
+                             } 
+                             no_std_subs 
+                             { CHECK0 } 
+                             CLOSE 
+                             { end_element(ELT_SUB_CHAN_TIME, PARENT, $<ctxt>5,
+                                          NULL);
+                            }
                            ;
 
 /* CHILD TO FAMILY LINK */
@@ -1471,10 +1977,16 @@ chi_fam_link_sub : famc_sect  /* 0:M */
                  ;
 
 famc_sect : OPEN DELIM TAG_FAMC mand_pointer
-            { START(FAMC, NULL) }
+            { $<ctxt>$ = start_element(ELT_SUB_FAMC,
+                                      PARENT, $1, $3, $4, 
+                                      GEDCOM_MAKE_STRING($4));
+             START(FAMC, $<ctxt>$) 
+            }
             famc_subs
            { CHECK0 }
-            CLOSE { }
+            CLOSE 
+            { end_element(ELT_SUB_FAMC, PARENT, $<ctxt>5, NULL);
+           }
           ;
 
 famc_subs : /* empty */
@@ -1487,7 +1999,16 @@ famc_sub  : famc_pedi_sect  /* 0:M */
           ;
 
 famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item 
-                 { START(PEDI, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_FAMC_PEDI,
+                                           PARENT, $1, $3, $4, 
+                                           GEDCOM_MAKE_STRING($4));
+                  START(PEDI, $<ctxt>$)  
+                 }  
+                 no_std_subs  
+                 { CHECK0 }  
+                 CLOSE  
+                 { end_element(ELT_SUB_FAMC_PEDI, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 /* CONTINUATION SUBSECTIONS */
@@ -1496,11 +2017,29 @@ continuation_sub : cont_sect  /* 0:M */
                  ;
 
 cont_sect : OPEN DELIM TAG_CONT mand_line_item 
-            { START(CONT, NULL) } no_std_subs { CHECK0 } CLOSE { }
+            { $<ctxt>$ = start_element(ELT_SUB_CONT,
+                                      PARENT, $1, $3, $4, 
+                                      GEDCOM_MAKE_STRING($4));
+             START(CONT, $<ctxt>$)  
+            }  
+            no_std_subs  
+            { CHECK0 }  
+            CLOSE  
+            { end_element(ELT_SUB_CONT, PARENT, $<ctxt>5, NULL);
+           }
           ;
 
 conc_sect : OPEN DELIM TAG_CONC mand_line_item 
-            { START(CONC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+            { $<ctxt>$ = start_element(ELT_SUB_CONC,
+                                      PARENT, $1, $3, $4, 
+                                      GEDCOM_MAKE_STRING($4));
+             START(CONC, $<ctxt>$)  
+            }  
+            no_std_subs  
+            { CHECK0 }  
+            CLOSE  
+            { end_element(ELT_SUB_CONC, PARENT, $<ctxt>5, NULL);
+           }
           ; 
 
 /* EVENT DETAIL */
@@ -1517,19 +2056,70 @@ event_detail_sub : event_detail_type_sect  { OCCUR2(TYPE, 0, 1) }
                  ;
 
 event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item 
-                         { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                         { $<ctxt>$ = start_element(ELT_SUB_EVT_TYPE,
+                                                   PARENT, $1, $3, $4, 
+                                                   GEDCOM_MAKE_STRING($4));
+                          START(TYPE, $<ctxt>$)  
+                         }  
+                         no_std_subs  
+                         { CHECK0 }  
+                         CLOSE  
+                         { end_element(ELT_SUB_EVT_TYPE, PARENT, $<ctxt>5,
+                                      NULL);
+                        }
                        ;
 event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item 
-                         { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                         { struct date_value dv = gedcom_parse_date($4);
+                          $<ctxt>$ = start_element(ELT_SUB_EVT_DATE,
+                                                   PARENT, $1, $3, $4, 
+                                                   GEDCOM_MAKE_DATE(dv));
+                          START(DATE, $<ctxt>$)  
+                         }  
+                         no_std_subs  
+                         { CHECK0 }  
+                         CLOSE  
+                         { end_element(ELT_SUB_EVT_DATE, PARENT, $<ctxt>5,
+                                      NULL);
+                        }
                        ;
 event_detail_age_sect  : OPEN DELIM TAG_AGE mand_line_item 
-                         { START(AGE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                         { $<ctxt>$ = start_element(ELT_SUB_EVT_AGE,
+                                                   PARENT, $1, $3, $4, 
+                                                   GEDCOM_MAKE_STRING($4));
+                          START(AGE, $<ctxt>$)  
+                         }  
+                         no_std_subs  
+                         { CHECK0 }  
+                         CLOSE  
+                         { end_element(ELT_SUB_EVT_AGE, PARENT, $<ctxt>5,
+                                      NULL);
+                        }
                        ;
 event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item 
-                         { START(AGNC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                         { $<ctxt>$ = start_element(ELT_SUB_EVT_AGNC,
+                                                   PARENT, $1, $3, $4, 
+                                                   GEDCOM_MAKE_STRING($4));
+                          START(AGNC, $<ctxt>$)  
+                         }  
+                         no_std_subs  
+                         { CHECK0 }  
+                         CLOSE  
+                         { end_element(ELT_SUB_EVT_AGNC, PARENT, $<ctxt>5,
+                                      NULL);
+                        }
                        ;
 event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item 
-                         { START(CAUS, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                         { $<ctxt>$ = start_element(ELT_SUB_EVT_CAUS,
+                                                   PARENT, $1, $3, $4, 
+                                                   GEDCOM_MAKE_STRING($4));
+                          START(CAUS, $<ctxt>$)  
+                         }  
+                         no_std_subs  
+                         { CHECK0 }  
+                         CLOSE  
+                         { end_element(ELT_SUB_EVT_CAUS, PARENT, $<ctxt>5,
+                                      NULL);
+                        }
                        ;
 
 /* FAMILY EVENT STRUCTURE */
@@ -1537,21 +2127,31 @@ fam_event_struc_sub : fam_event_sect
                     | fam_gen_even_sect  /* 0:M */
                     ;
 
-fam_event_sect : OPEN DELIM fam_event_tag opt_value fam_event_subs
+fam_event_sect : OPEN DELIM fam_event_tag opt_value  
+                 { 
+                  $<ctxt>$ = start_element(ELT_SUB_FAM_EVT,
+                                           PARENT, $1, $3, $4,
+                                           GEDCOM_MAKE_NULL_OR_STRING($4));
+                  /* set the parent context separately from START here */
+                  set_parentctxt($<ctxt>$);
+                }
+                 fam_event_subs
                  { CHECK0 }
-                 CLOSE { }
-               ;
-
-fam_event_tag : TAG_ANUL { START(ANUL, NULL) }
-              | TAG_CENS { START(CENS, NULL) }
-              | TAG_DIV { START(DIV, NULL) }
-              | TAG_DIVF { START(DIVF, NULL) }
-              | TAG_ENGA { START(ENGA, NULL) }
-              | TAG_MARR { START(MARR, NULL) }
-              | TAG_MARB { START(MARB, NULL) }
-              | TAG_MARC { START(MARC, NULL) }
-              | TAG_MARL { START(MARL, NULL) }
-              | TAG_MARS { START(MARS, NULL) }
+                 CLOSE 
+                 { end_element(ELT_SUB_FAM_EVT, PARENT, $<ctxt>5, NULL);
+                }
+               ;
+
+fam_event_tag : TAG_ANUL { $$ = $1; START(ANUL, NULL) }
+              | TAG_CENS { $$ = $1; START(CENS, NULL) }
+              | TAG_DIV { $$ = $1; START(DIV, NULL) }
+              | TAG_DIVF { $$ = $1; START(DIVF, NULL) }
+              | TAG_ENGA { $$ = $1; START(ENGA, NULL) }
+              | TAG_MARR { $$ = $1; START(MARR, NULL) }
+              | TAG_MARB { $$ = $1; START(MARB, NULL) }
+              | TAG_MARC { $$ = $1; START(MARC, NULL) }
+              | TAG_MARL { $$ = $1; START(MARL, NULL) }
+              | TAG_MARS { $$ = $1; START(MARS, NULL) }
               ;
 
 fam_event_subs : /* empty */
@@ -1565,36 +2165,67 @@ fam_event_sub : event_detail_sub
               ;
 
 fam_even_husb_sect : OPEN DELIM TAG_HUSB
-                     { START(HUSB, NULL) }
+                     { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_HUSB,
+                                               PARENT, $1, $3, NULL,
+                                               GEDCOM_MAKE_NULL());
+                      START(HUSB, $<ctxt>$) 
+                     }
                      fam_even_husb_subs
                     { CHECK1(AGE) }
-                     CLOSE { }
+                     CLOSE 
+                     { end_element(ELT_SUB_FAM_EVT_HUSB, PARENT, $<ctxt>4,
+                                  NULL);
+                    }
                    ;
 
 fam_even_husb_subs : /* empty */
                    | fam_even_husb_subs fam_even_husb_sub
                    ;
 
-fam_even_husb_sub : fam_even_husb_age_sect  { OCCUR2(AGE, 1, 1) }
+fam_even_husb_sub : fam_even_age_sect  { OCCUR2(AGE, 1, 1) }
                   | no_std_sub
                   ;
 
-fam_even_husb_age_sect : OPEN DELIM TAG_AGE mand_line_item  
-                         { START(AGE, NULL) } no_std_subs { CHECK0 } CLOSE { }
-                       ;
+fam_even_age_sect : OPEN DELIM TAG_AGE mand_line_item  
+                    { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_AGE,
+                                              PARENT, $1, $3, $4,
+                                              GEDCOM_MAKE_STRING($4));
+                     START(AGE, $<ctxt>$)   
+                    }   
+                    no_std_subs   
+                    { CHECK0 }   
+                    CLOSE   
+                    { end_element(ELT_SUB_FAM_EVT_AGE, PARENT, $<ctxt>5,
+                                 NULL);
+                   }
+                  ;
 
 fam_even_wife_sect : OPEN DELIM TAG_WIFE
-                     { START(HUSB, NULL) }
+                     { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_WIFE,
+                                               PARENT, $1, $3, NULL,
+                                               GEDCOM_MAKE_NULL());
+                      START(WIFE, $<ctxt>$) 
+                     }
                      fam_even_husb_subs
                     { CHECK1(AGE) }
-                     CLOSE { }
+                     CLOSE 
+                     { end_element(ELT_SUB_FAM_EVT_WIFE, PARENT, $<ctxt>4,
+                                  NULL);
+                    }
                    ;
 
 fam_gen_even_sect : OPEN DELIM TAG_EVEN
-                    { START(EVEN, NULL) }
+                    { $<ctxt>$ = start_element(ELT_SUB_FAM_EVT_EVEN,
+                                               PARENT, $1, $3, NULL,
+                                               GEDCOM_MAKE_NULL());
+                      START(EVEN, $<ctxt>$) 
+                    }
                     fam_gen_even_subs
                    { CHECK0 }
-                    CLOSE { }
+                    CLOSE 
+                    { end_element(ELT_SUB_FAM_EVT_EVEN, PARENT, $<ctxt>4,
+                                 NULL);
+                   }
                   ;
 
 fam_gen_even_subs : /* empty */
@@ -1613,10 +2244,17 @@ ident_struc_sub : ident_refn_sect  /* 0:M */
                 ;
 
 ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item 
-                  { START(REFN, NULL) }
+                  { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN,
+                                            PARENT, $1, $3, $4,
+                                            GEDCOM_MAKE_STRING($4));
+                   START(REFN, $<ctxt>$)  
+                  }
                   ident_refn_subs
                  { CHECK0 }
-                  CLOSE { }
+                  CLOSE  
+                  { end_element(ELT_SUB_IDENT_REFN, PARENT, $<ctxt>5,
+                               NULL);
+                 }
                 ;
 
 ident_refn_subs : /* empty */
@@ -1628,106 +2266,75 @@ ident_refn_sub  : ident_refn_type_sect  { OCCUR2(TYPE, 0, 1) }
                 ;
 
 ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item   
-                       { START(TYPE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                       { $<ctxt>$ = start_element(ELT_SUB_IDENT_REFN_TYPE,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(TYPE, $<ctxt>$)    
+                       }    
+                       no_std_subs    
+                       { CHECK0 }    
+                       CLOSE    
+                       { end_element(ELT_SUB_IDENT_REFN_TYPE, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
 ident_rin_sect  : OPEN DELIM TAG_RIN mand_line_item   
-                  { START(RIN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                  { $<ctxt>$ = start_element(ELT_SUB_IDENT_RIN,
+                                            PARENT, $1, $3, $4,
+                                            GEDCOM_MAKE_STRING($4));
+                   START(RIN, $<ctxt>$)    
+                  }    
+                  no_std_subs    
+                  { CHECK0 }    
+                  CLOSE    
+                  { end_element(ELT_SUB_IDENT_RIN, PARENT, $<ctxt>5,
+                               NULL);
+                 }
                 ;
 
 /* INDIVIDUAL ATTRIBUTE STRUCTURE */
-indiv_attr_struc_sub : indiv_cast_sect  /* 0:M */
-                     | indiv_dscr_sect  /* 0:M */
-                     | indiv_educ_sect  /* 0:M */
-                     | indiv_idno_sect  /* 0:M */
-                     | indiv_nati_sect  /* 0:M */
-                     | indiv_nchi_sect  /* 0:M */
-                     | indiv_nmr_sect  /* 0:M */
-                     | indiv_occu_sect  /* 0:M */
-                     | indiv_prop_sect  /* 0:M */
-                     | indiv_reli_sect  /* 0:M */
+indiv_attr_struc_sub : indiv_attr_sect   /* 0:M */
                      | indiv_resi_sect  /* 0:M */
-                     | indiv_ssn_sect  /* 0:M */
-                     | indiv_titl_sect  /* 0:M */
                      ;
 
-indiv_cast_sect : OPEN DELIM TAG_CAST mand_line_item 
-                  { START(CAST, NULL) }
-                  indiv_attr_event_subs
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_dscr_sect : OPEN DELIM TAG_DSCR mand_line_item 
-                  { START(DSCR, NULL) }
+indiv_attr_sect : OPEN DELIM indiv_attr_tag mand_line_item
+                  { $<ctxt>$ = start_element(ELT_SUB_INDIV_ATTR,
+                                            PARENT, $1, $3, $4,
+                                            GEDCOM_MAKE_STRING($4));
+                   /* set the parent context separately from START here */
+                   set_parentctxt($<ctxt>$);
+                 }
                   indiv_attr_event_subs
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_educ_sect : OPEN DELIM TAG_EDUC mand_line_item  
-                  { START(EDUC, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_idno_sect : OPEN DELIM TAG_IDNO mand_line_item 
-                  { START(IDNO, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_nati_sect : OPEN DELIM TAG_NATI mand_line_item 
-                  { START(NATI, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item 
-                  { START(NCHI, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_nmr_sect  : OPEN DELIM TAG_NMR mand_line_item 
-                  { START(NMR, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_occu_sect : OPEN DELIM TAG_OCCU mand_line_item 
-                  { START(OCCU, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_prop_sect : OPEN DELIM TAG_PROP mand_line_item 
-                  { START(PROP, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_reli_sect : OPEN DELIM TAG_RELI mand_line_item 
-                  { START(RELI, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
+                  { CHECK0 }
+                  CLOSE
+                  { end_element(ELT_SUB_INDIV_ATTR, PARENT, $<ctxt>5, NULL);
+                 }
+
+indiv_attr_tag  : TAG_CAST { $$ = $1; START(CAST, NULL) }
+                | TAG_DSCR { $$ = $1; START(DSCR, NULL) }
+                | TAG_EDUC { $$ = $1; START(EDUC, NULL) }
+                | TAG_IDNO { $$ = $1; START(IDNO, NULL) }
+                | TAG_NATI { $$ = $1; START(NATI, NULL) }
+                | TAG_NCHI { $$ = $1; START(NCHI, NULL) }
+                | TAG_NMR  { $$ = $1; START(NMR, NULL) }
+                | TAG_OCCU { $$ = $1; START(OCCU, NULL) }
+                | TAG_PROP { $$ = $1; START(PROP, NULL) }
+                | TAG_RELI { $$ = $1; START(RELI, NULL) }
+                | TAG_SSN  { $$ = $1; START(SSN, NULL) }
+                | TAG_TITL { $$ = $1; START(TITL, NULL) }
+
 indiv_resi_sect : OPEN DELIM TAG_RESI 
-                  { START(RESI, NULL) }
+                  { $<ctxt>$ = start_element(ELT_SUB_INDIV_RESI,
+                                            PARENT, $1, $3, NULL,
+                                            GEDCOM_MAKE_NULL());
+                   START(RESI, $<ctxt>$)  
+                  }
                   indiv_attr_event_subs 
                  { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_ssn_sect  : OPEN DELIM TAG_SSN mand_line_item 
-                  { START(SSN, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
-                ;
-indiv_titl_sect : OPEN DELIM TAG_TITL mand_line_item 
-                  { START(TITL, NULL) }
-                  indiv_attr_event_subs 
-                 { CHECK0 }
-                  CLOSE { }
+                  CLOSE  
+                  { end_element(ELT_SUB_INDIV_RESI, PARENT, $<ctxt>4, NULL);
+                 }
                 ;
 
 indiv_attr_event_subs : /* empty */
@@ -1745,13 +2352,22 @@ indiv_even_struc_sub : indiv_birt_sect
                      | indiv_even_sect  /* 0:M */
                      ;
 
-indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value indiv_birt_subs
+indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value 
+                  { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT,
+                                            PARENT, $1, $3, $4,
+                                            GEDCOM_MAKE_NULL_OR_STRING($4));
+                   /* set the parent context separately from START here */
+                   set_parentctxt($<ctxt>$);
+                 }
+                  indiv_birt_subs
                   { CHECK0 }
-                  CLOSE { }
+                  CLOSE 
+                  { end_element(ELT_SUB_INDIV_BIRT, PARENT, $<ctxt>5, NULL);
+                 }
                 ;
 
-indiv_birt_tag  : TAG_BIRT { START(BIRT, NULL) }
-                | TAG_CHR { START(CHR, NULL) }
+indiv_birt_tag  : TAG_BIRT { $$ = $1; START(BIRT, NULL) }
+                | TAG_CHR { $$ = $1; START(CHR, NULL) }
                 ;
 
 indiv_birt_subs : /* empty */
@@ -1764,33 +2380,52 @@ indiv_birt_sub  : event_detail_sub
                 ;
 
 indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
-                       { START(FAMC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                       { $<ctxt>$ = start_element(ELT_SUB_INDIV_BIRT_FAMC,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(FAMC, $<ctxt>$) 
+                       } 
+                       no_std_subs 
+                       { CHECK0 } 
+                       CLOSE 
+                       { end_element(ELT_SUB_INDIV_BIRT_FAMC, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
-indiv_gen_sect  : OPEN DELIM indiv_gen_tag opt_value indiv_gen_subs
+indiv_gen_sect  : OPEN DELIM indiv_gen_tag opt_value 
+                  { $<ctxt>$ = start_element(ELT_SUB_INDIV_GEN,
+                                            PARENT, $1, $3, $4,
+                                            GEDCOM_MAKE_NULL_OR_STRING($4));
+                   /* set the parent context separately from START here */
+                   set_parentctxt($<ctxt>$);
+                 }
+                  indiv_gen_subs
                   { CHECK0 }
-                  CLOSE { }
+                  CLOSE 
+                  { end_element(ELT_SUB_INDIV_GEN, PARENT, $<ctxt>5, NULL);
+                 }
                 ;
 
-indiv_gen_tag   : TAG_DEAT { START(DEAT, NULL) }
-                | TAG_BURI { START(BURI, NULL) }
-                | TAG_CREM { START(CREM, NULL) }
-                | TAG_BAPM { START(BAPM, NULL) }
-                | TAG_BARM { START(BARM, NULL) }
-                | TAG_BASM { START(BASM, NULL) }
-                | TAG_BLES { START(BLES, NULL) }
-                | TAG_CHRA { START(CHRA, NULL) }
-                | TAG_CONF { START(CONF, NULL) }
-                | TAG_FCOM { START(FCOM, NULL) }
-                | TAG_ORDN { START(ORDN, NULL) }
-                | TAG_NATU { START(NATU, NULL) }
-                | TAG_EMIG { START(EMIG, NULL) }
-                | TAG_IMMI { START(IMMI, NULL) }
-                | TAG_CENS { START(CENS, NULL) }
-                | TAG_PROB { START(PROB, NULL) }
-                | TAG_WILL { START(WILL, NULL) }
-                | TAG_GRAD { START(GRAD, NULL) }
-                | TAG_RETI { START(RETI, NULL) }
+indiv_gen_tag   : TAG_DEAT { $$ = $1; START(DEAT, NULL) }
+                | TAG_BURI { $$ = $1; START(BURI, NULL) }
+                | TAG_CREM { $$ = $1; START(CREM, NULL) }
+                | TAG_BAPM { $$ = $1; START(BAPM, NULL) }
+                | TAG_BARM { $$ = $1; START(BARM, NULL) }
+                | TAG_BASM { $$ = $1; START(BASM, NULL) }
+                | TAG_BLES { $$ = $1; START(BLES, NULL) }
+                | TAG_CHRA { $$ = $1; START(CHRA, NULL) }
+                | TAG_CONF { $$ = $1; START(CONF, NULL) }
+                | TAG_FCOM { $$ = $1; START(FCOM, NULL) }
+                | TAG_ORDN { $$ = $1; START(ORDN, NULL) }
+                | TAG_NATU { $$ = $1; START(NATU, NULL) }
+                | TAG_EMIG { $$ = $1; START(EMIG, NULL) }
+                | TAG_IMMI { $$ = $1; START(IMMI, NULL) }
+                | TAG_CENS { $$ = $1; START(CENS, NULL) }
+                | TAG_PROB { $$ = $1; START(PROB, NULL) }
+                | TAG_WILL { $$ = $1; START(WILL, NULL) }
+                | TAG_GRAD { $$ = $1; START(GRAD, NULL) }
+                | TAG_RETI { $$ = $1; START(RETI, NULL) }
                 ;
 
 indiv_gen_subs  : /* empty */
@@ -1802,10 +2437,15 @@ indiv_gen_sub   : event_detail_sub
                 ;
 
 indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value 
-                  { START(ADOP, NULL) }
+                  { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP,
+                                            PARENT, $1, $3, $4,
+                                            GEDCOM_MAKE_NULL_OR_STRING($4));
+                   START(ADOP, $<ctxt>$) }
                   indiv_adop_subs
                  { CHECK0 }
-                  CLOSE { }
+                  CLOSE 
+                  { end_element(ELT_SUB_INDIV_ADOP, PARENT, $<ctxt>5, NULL);
+                 }
                 ;
 
 indiv_adop_subs : /* empty */
@@ -1818,10 +2458,16 @@ indiv_adop_sub  : event_detail_sub
                 ;
 
 indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
-                       { START(FAMC, NULL) }
+                       { $<ctxt>$ = start_element(ELT_SUB_INDIV_ADOP_FAMC,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(FAMC, $<ctxt>$) }
                        indiv_adop_famc_subs
                       { CHECK0 }
-                       CLOSE { }
+                       CLOSE 
+                      { end_element(ELT_SUB_INDIV_ADOP_FAMC, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
 indiv_adop_famc_subs : /* empty */
@@ -1833,14 +2479,29 @@ indiv_adop_famc_sub  : indiv_adop_famc_adop_sect  { OCCUR2(ADOP,0, 1) }
                      ;
 
 indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item   
-                            { START(ADOP, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                            { $<ctxt>$
+                               = start_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                             START(ADOP, $<ctxt>$) }    
+                            no_std_subs    
+                            { CHECK0 }    
+                            CLOSE    
+                            { end_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP,
+                                         PARENT, $<ctxt>5, NULL);
+                           }
                           ;
 
 indiv_even_sect : OPEN DELIM TAG_EVEN
-                  { START(EVEN, NULL) }
+                  { $<ctxt>$ = start_element(ELT_SUB_INDIV_EVEN,
+                                            PARENT, $1, $3, NULL,
+                                            GEDCOM_MAKE_NULL());
+                   START(EVEN, $<ctxt>$) }
                   indiv_gen_subs
                  { CHECK0 }
-                  CLOSE { }
+                  CLOSE    
+                  { end_element(ELT_SUB_INDIV_EVEN, PARENT, $<ctxt>4, NULL);
+                 }
                 ;
 
 /* LDS INDIVIDUAL ORDINANCE */
@@ -1848,14 +2509,23 @@ lds_indiv_ord_sub : lio_bapl_sect  /* 0:M */
                   | lio_slgc_sect  /* 0:M */
                   ;
 
-lio_bapl_sect : OPEN DELIM lio_bapl_tag lio_bapl_subs
+lio_bapl_sect : OPEN DELIM lio_bapl_tag 
+                { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL,
+                                          PARENT, $1, $3, NULL,
+                                          GEDCOM_MAKE_NULL());
+                 /* set the parent context separately from START here */
+                 set_parentctxt($<ctxt>$);
+               }
+                lio_bapl_subs
                 { CHECK0 }
-                CLOSE { }
+                CLOSE 
+                { end_element(ELT_SUB_LIO_BAPL, PARENT, $<ctxt>4, NULL);
+               }
               ;
 
-lio_bapl_tag  : TAG_BAPL { START(BAPL, NULL) }
-              | TAG_CONL { START(CONL, NULL) }
-              | TAG_ENDL { START(ENDL, NULL) }
+lio_bapl_tag  : TAG_BAPL { $$ = $1; START(BAPL, NULL) }
+              | TAG_CONL { $$ = $1; START(CONL, NULL) }
+              | TAG_ENDL { $$ = $1; START(ENDL, NULL) }
               ;
 
 lio_bapl_subs : /* empty */
@@ -1872,23 +2542,70 @@ lio_bapl_sub  : lio_bapl_stat_sect  { OCCUR2(STAT, 0, 1) }
               ;
 
 lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item   
-                     { START(STAT, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_STAT,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(STAT, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LIO_BAPL_STAT, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item   
-                     { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { struct date_value dv = gedcom_parse_date($4);
+                      $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_DATE,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_DATE(dv));
+                      START(DATE, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LIO_BAPL_DATE, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item   
-                     { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_TEMP,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(TEMP, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LIO_BAPL_TEMP, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item   
-                     { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { $<ctxt>$ = start_element(ELT_SUB_LIO_BAPL_PLAC,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(PLAC, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LIO_BAPL_PLAC, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 
 lio_slgc_sect : OPEN DELIM TAG_SLGC
-                { START(SLGC, NULL) }
+                { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC,
+                                          PARENT, $1, $3, NULL,
+                                          GEDCOM_MAKE_NULL());
+                 START(SLGC, $<ctxt>$) 
+                }
                 lio_slgc_subs
                { CHECK1(FAMC) }
-                CLOSE { }
+                CLOSE 
+                { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
+               }
               ;
 
 lio_slgc_subs : /* empty */
@@ -1900,7 +2617,17 @@ lio_slgc_sub  : lio_bapl_sub
               ;
 
 lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer
-                     { START(FAMC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { $<ctxt>$ = start_element(ELT_SUB_LIO_SLGC_FAMC,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(FAMC, $<ctxt>$) 
+                     } 
+                     no_std_subs 
+                     { CHECK0 } 
+                     CLOSE 
+                     { end_element(ELT_SUB_LIO_SLGC_FAMC, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 
 /* LDS SPOUSE SEALING */
@@ -1908,10 +2635,15 @@ lds_spouse_seal_sub : lss_slgs_sect
                     ;
 
 lss_slgs_sect : OPEN DELIM TAG_SLGS
-                { START(SLGS, NULL) }
+                { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS,
+                                          PARENT, $1, $3, NULL,
+                                          GEDCOM_MAKE_NULL());
+                 START(SLGS, $<ctxt>$) }
                 lss_slgs_subs
                { CHECK0 }
-                CLOSE { }
+                CLOSE 
+                { end_element(ELT_SUB_LIO_SLGC, PARENT, $<ctxt>4, NULL);
+               }
               ;
 
 lss_slgs_subs : /* empty */
@@ -1928,16 +2660,57 @@ lss_slgs_sub  : lss_slgs_stat_sect  { OCCUR2(STAT, 0, 1) }
               ;
 
 lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item   
-                     { START(STAT, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_STAT,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(STAT, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LSS_SLGS_STAT, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item   
-                     { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { struct date_value dv = gedcom_parse_date($4);
+                      $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_DATE,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_DATE(dv));
+                      START(DATE, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LSS_SLGS_DATE, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item   
-                     { START(TEMP, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_TEMP,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(TEMP, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LSS_SLGS_TEMP, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item   
-                     { START(PLAC, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                     { $<ctxt>$ = start_element(ELT_SUB_LSS_SLGS_PLAC,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(PLAC, $<ctxt>$)    
+                     }    
+                     no_std_subs    
+                     { CHECK0 }    
+                     CLOSE    
+                     { end_element(ELT_SUB_LSS_SLGS_PLAC, PARENT, $<ctxt>5,
+                                  NULL);
+                    }
                    ;
 
 /* MULTIMEDIA LINK */
@@ -1946,14 +2719,31 @@ multim_link_sub : multim_obje_link_sect
                 ;
 
 multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER    
-                        { START(OBJE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                        { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
+                                                  PARENT, $1, $3, $5,
+                                                  GEDCOM_MAKE_STRING($5));
+                         START(OBJE, $<ctxt>$)     
+                        }     
+                        no_std_subs     
+                        { CHECK0 }     
+                        CLOSE     
+                        { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>6,
+                                     NULL);
+                       }
                       ;
 
 multim_obje_emb_sect : OPEN DELIM TAG_OBJE
-                       { START(OBJE, NULL) }
+                       { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE,
+                                                 PARENT, $1, $3, NULL,
+                                                 GEDCOM_MAKE_NULL());
+                        START(OBJE, $<ctxt>$) 
+                       }
                        multim_obje_emb_subs
                       { CHECK2(FORM,FILE) }
-                       CLOSE { }
+                       CLOSE 
+                       { end_element(ELT_SUB_MULTIM_OBJE, PARENT, $<ctxt>4,
+                                    NULL);
+                      }
                      ;
 
 multim_obje_emb_subs : /* empty */
@@ -1968,13 +2758,43 @@ multim_obje_emb_sub : multim_obje_form_sect  { OCCUR2(FORM, 1, 1) }
                     ;
 
 multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item    
-                        { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                        { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FORM,
+                                                  PARENT, $1, $3, $4,
+                                                  GEDCOM_MAKE_STRING($4));
+                         START(FORM, $<ctxt>$)     
+                        }     
+                        no_std_subs     
+                        { CHECK0 }     
+                        CLOSE     
+                        { end_element(ELT_SUB_MULTIM_OBJE_FORM,
+                                     PARENT, $<ctxt>5, NULL);
+                       }
                       ;
 multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item    
-                        { START(TITL, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                        { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_TITL,
+                                                  PARENT, $1, $3, $4,
+                                                  GEDCOM_MAKE_STRING($4));
+                         START(TITL, $<ctxt>$)     
+                        }     
+                        no_std_subs     
+                        { CHECK0 }     
+                        CLOSE     
+                        { end_element(ELT_SUB_MULTIM_OBJE_TITL,
+                                     PARENT, $<ctxt>5, NULL);
+                       }
                       ;
 multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item    
-                        { START(FILE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                        { $<ctxt>$ = start_element(ELT_SUB_MULTIM_OBJE_FILE,
+                                                  PARENT, $1, $3, $4,
+                                                  GEDCOM_MAKE_STRING($4));
+                         START(FILE, $<ctxt>$)     
+                        }     
+                        no_std_subs     
+                        { CHECK0 }     
+                        CLOSE     
+                        { end_element(ELT_SUB_MULTIM_OBJE_FILE,
+                                     PARENT, $<ctxt>5, NULL);
+                       }
                       ;
 
 /* NOTE STRUCTURE */
@@ -1983,10 +2803,16 @@ note_struc_sub : note_struc_link_sect  /* 0:M */
                ;
 
 note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER
-                       { START(NOTE, NULL) }
+                       { $<ctxt>$ = start_element(ELT_SUB_NOTE,
+                                                 PARENT, $1, $3, $5,
+                                                 GEDCOM_MAKE_STRING($5));
+                        START(NOTE, $<ctxt>$) 
+                       }
                        note_struc_link_subs
                       { CHECK0 }
-                       CLOSE { }
+                       CLOSE 
+                       { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>6, NULL);
+                      }
                      ;
 
 note_struc_link_subs : /* empty */
@@ -1998,10 +2824,17 @@ note_struc_link_sub : source_cit_sub
                     ;
 
 note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item
-                      { START(NOTE, NULL) }
+                      { $<ctxt>$
+                         = start_element(ELT_SUB_NOTE,
+                                         PARENT, $1, $3, $4,
+                                         GEDCOM_MAKE_NULL_OR_STRING($4));
+                       START(NOTE, $<ctxt>$) 
+                      }
                       note_struc_emb_subs
                      { CHECK0 }
-                      CLOSE { }
+                      CLOSE 
+                      { end_element(ELT_SUB_NOTE, PARENT, $<ctxt>5, NULL);
+                     }
                     ;
 
 note_struc_emb_subs : /* empty */
@@ -2018,10 +2851,16 @@ pers_name_struc_sub : pers_name_sect /* 0:M */
                     ;
 
 pers_name_sect : OPEN DELIM TAG_NAME mand_line_item 
-                 { START(NAME, NULL) }
+                 { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME,
+                                           PARENT, $1, $3, $4,
+                                           GEDCOM_MAKE_STRING($4));
+                  START(NAME, $<ctxt>$)  
+                 }
                  pers_name_subs
                 { CHECK0 }
-                 CLOSE { }
+                 CLOSE  
+                 { end_element(ELT_SUB_PERS_NAME, PARENT, $<ctxt>5, NULL);
+                }
                ;
 
 pers_name_subs : /* empty */
@@ -2040,22 +2879,82 @@ pers_name_sub  : pers_name_npfx_sect  { OCCUR2(NPFX, 0, 1) }
                ;
 
 pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item    
-                      { START(NPFX, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NPFX,
+                                                PARENT, $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
+                       START(NPFX, $<ctxt>$)     
+                      }     
+                      no_std_subs     
+                      { CHECK0 }     
+                      CLOSE     
+                      { end_element(ELT_SUB_PERS_NAME_NPFX, PARENT, $<ctxt>5,
+                                   NULL);
+                     }
                     ;
 pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item    
-                      { START(GIVN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_GIVN,
+                                                PARENT, $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
+                       START(GIVN, $<ctxt>$)     
+                      }     
+                      no_std_subs     
+                      { CHECK0 }     
+                      CLOSE     
+                      { end_element(ELT_SUB_PERS_NAME_GIVN, PARENT, $<ctxt>5,
+                                   NULL);
+                     }
                     ;
 pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item    
-                      { START(NICK, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NICK,
+                                                PARENT, $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
+                       START(NICK, $<ctxt>$)     
+                      }     
+                      no_std_subs     
+                      { CHECK0 }     
+                      CLOSE     
+                      { end_element(ELT_SUB_PERS_NAME_NICK, PARENT, $<ctxt>5,
+                                   NULL);
+                     }
                     ;
 pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item    
-                      { START(SPFX, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SPFX,
+                                                PARENT, $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
+                       START(SPFX, $<ctxt>$)     
+                      }     
+                      no_std_subs     
+                      { CHECK0 }     
+                      CLOSE     
+                      { end_element(ELT_SUB_PERS_NAME_SPFX, PARENT, $<ctxt>5,
+                                   NULL);
+                     }
                     ;
 pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item    
-                      { START(SURN, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_SURN,
+                                                PARENT, $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
+                       START(SURN, $<ctxt>$)     
+                      }     
+                      no_std_subs     
+                      { CHECK0 }     
+                      CLOSE     
+                      { end_element(ELT_SUB_PERS_NAME_SURN, PARENT, $<ctxt>5,
+                                   NULL);
+                     }
                     ;
 pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item    
-                      { START(NSFX, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                      { $<ctxt>$ = start_element(ELT_SUB_PERS_NAME_NSFX,
+                                                PARENT, $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
+                       START(NSFX, $<ctxt>$)     
+                      }     
+                      no_std_subs     
+                      { CHECK0 }     
+                      CLOSE     
+                      { end_element(ELT_SUB_PERS_NAME_NSFX, PARENT, $<ctxt>5,
+                                   NULL);
+                     }
                     ;
 
 /* PLACE STRUCTURE */
@@ -2063,10 +2962,16 @@ place_struc_sub : place_struc_plac_sect /* 0:M */
                 ;
 
 place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item 
-                        { START(PLAC, NULL) }
+                        { $<ctxt>$ = start_element(ELT_SUB_PLAC,
+                                                  PARENT, $1, $3, $4,
+                                                  GEDCOM_MAKE_STRING($4));
+                         START(PLAC, $<ctxt>$)  
+                        }
                         place_struc_plac_subs
                        { CHECK0 }
-                        CLOSE { }
+                        CLOSE  
+                        { end_element(ELT_SUB_PLAC, PARENT, $<ctxt>5, NULL);
+                       }
                       ;
 
 place_struc_plac_subs : /* empty */
@@ -2080,7 +2985,17 @@ place_struc_plac_sub : place_plac_form_sect  { OCCUR2(FORM, 0, 1) }
                      ;
 
 place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item    
-                       { START(FORM, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                       { $<ctxt>$ = start_element(ELT_SUB_PLAC_FORM,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(FORM, $<ctxt>$)     
+                       }     
+                       no_std_subs     
+                       { CHECK0 }     
+                       CLOSE     
+                       { end_element(ELT_SUB_PLAC_FORM, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
 /* SOURCE_CITATION */
@@ -2089,10 +3004,16 @@ source_cit_sub : source_cit_link_sect /* 0:M */
                ;
 
 source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER
-                       { START(SOUR, NULL) }
+                       { $<ctxt>$ = start_element(ELT_SUB_SOUR,
+                                                 PARENT, $1, $3, $5,
+                                                 GEDCOM_MAKE_STRING($5));
+                        START(SOUR, $<ctxt>$) 
+                       }
                        source_cit_link_subs
                       { CHECK0 }
-                       CLOSE { }
+                       CLOSE 
+                       { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>6, NULL);
+                      }
                      ;
 
 source_cit_link_subs : /* empty */
@@ -2109,14 +3030,31 @@ source_cit_link_sub : source_cit_page_sect  { OCCUR2(PAGE, 0, 1) }
                     ;
 
 source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item    
-                       { START(PAGE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                       { $<ctxt>$ = start_element(ELT_SUB_SOUR_PAGE,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(PAGE, $<ctxt>$)     
+                       }     
+                       no_std_subs     
+                       { CHECK0 }     
+                       CLOSE     
+                       { end_element(ELT_SUB_SOUR_PAGE, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
 source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item 
-                       { START(EVEN, NULL) }
+                       { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(EVEN, $<ctxt>$)     
+                       }
                        source_cit_even_subs
                       { CHECK0 }
-                       CLOSE { }
+                       CLOSE     
+                       { end_element(ELT_SUB_SOUR_EVEN, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
 source_cit_even_subs : /* empty */
@@ -2128,14 +3066,31 @@ source_cit_even_sub  : source_cit_even_role_sect  { OCCUR2(ROLE, 0, 1) }
                      ;
 
 source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item    
-                          { START(ROLE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                          { $<ctxt>$ = start_element(ELT_SUB_SOUR_EVEN_ROLE,
+                                                    PARENT, $1, $3, $4,
+                                                    GEDCOM_MAKE_STRING($4));
+                           START(ROLE, $<ctxt>$)     
+                          }     
+                          no_std_subs     
+                          { CHECK0 }     
+                          CLOSE     
+                          { end_element(ELT_SUB_SOUR_EVEN_ROLE,
+                                       PARENT, $<ctxt>5, NULL);
+                         }
                           ;
 
 source_cit_data_sect : OPEN DELIM TAG_DATA
-                       { START(DATA, NULL) }
+                       { $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA,
+                                                 PARENT, $1, $3, NULL,
+                                                 GEDCOM_MAKE_NULL());
+                        START(DATA, $<ctxt>$) 
+                       }
                        source_cit_data_subs
                       { CHECK0 }
-                       CLOSE { }
+                       CLOSE 
+                       { end_element(ELT_SUB_SOUR_DATA, PARENT, $<ctxt>4,
+                                    NULL);
+                      }
                      ;
 
 source_cit_data_subs : /* empty */
@@ -2148,14 +3103,32 @@ source_cit_data_sub : source_cit_data_date_sect  { OCCUR2(DATE, 0, 1) }
                     ;
 
 source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item    
-                            { START(DATE, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                            { struct date_value dv = gedcom_parse_date($4);
+                             $<ctxt>$ = start_element(ELT_SUB_SOUR_DATA_DATE,
+                                                      PARENT, $1, $3, $4,
+                                                      GEDCOM_MAKE_DATE(dv));
+                             START(DATE, $<ctxt>$)     
+                            }     
+                            no_std_subs     
+                            { CHECK0 }     
+                            CLOSE     
+                            { end_element(ELT_SUB_SOUR_DATA_DATE,
+                                         PARENT, $<ctxt>5, NULL);
+                           }
                           ;
 
 source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item 
-                       { START(TEXT, NULL) }
+                       { $<ctxt>$ = start_element(ELT_SUB_SOUR_TEXT,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(TEXT, $<ctxt>$)  
+                       }
                        source_cit_text_subs
                       { CHECK0 }
-                       CLOSE { }
+                       CLOSE  
+                       { end_element(ELT_SUB_SOUR_TEXT, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
 source_cit_text_subs : /* empty */
@@ -2167,14 +3140,30 @@ source_cit_text_sub : continuation_sub
                     ;
 
 source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item    
-                       { START(QUAY, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                       { $<ctxt>$ = start_element(ELT_SUB_SOUR_QUAY,
+                                                 PARENT, $1, $3, $4,
+                                                 GEDCOM_MAKE_STRING($4));
+                        START(QUAY, $<ctxt>$)     
+                       }     
+                       no_std_subs     
+                       { CHECK0 }     
+                       CLOSE     
+                       { end_element(ELT_SUB_SOUR_QUAY, PARENT, $<ctxt>5,
+                                    NULL);
+                      }
                      ;
 
 source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item
-                      { START(SOUR, NULL) }
+                      { $<ctxt>$ = start_element(ELT_SUB_SOUR,
+                                                PARENT, $1, $3, $4,
+                                                GEDCOM_MAKE_STRING($4));
+                       START(SOUR, $<ctxt>$) 
+                      }
                       source_cit_emb_subs
                      { CHECK0 }
-                      CLOSE { }
+                      CLOSE 
+                      { end_element(ELT_SUB_SOUR, PARENT, $<ctxt>5, NULL);
+                     }
                     ;
 
 source_cit_emb_subs : /* empty */
@@ -2192,10 +3181,16 @@ source_repos_cit_sub : source_repos_repo_sect  { OCCUR2(REPO, 0, 1) }
                      ;
 
 source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer
-                         { START(REPO, NULL) }
+                         { $<ctxt>$ = start_element(ELT_SUB_REPO,
+                                                   PARENT, $1, $3, $4,
+                                                   GEDCOM_MAKE_STRING($4));
+                          START(REPO, $<ctxt>$) 
+                         }
                          source_repos_repo_subs
                         { CHECK0 }
-                         CLOSE { }
+                         CLOSE 
+                         { end_element(ELT_SUB_REPO, PARENT, $<ctxt>5, NULL);
+                        }
                        ;
 
 source_repos_repo_subs : /* empty */
@@ -2208,10 +3203,16 @@ source_repos_repo_sub  : note_struc_sub
                        ;
 
 caln_sect : OPEN DELIM TAG_CALN mand_line_item 
-            { START(CALN, NULL) }
+            { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN,
+                                      PARENT, $1, $3, $4,
+                                      GEDCOM_MAKE_STRING($4));
+             START(CALN, $<ctxt>$) 
+           }
             caln_subs
            { CHECK0 }
-            CLOSE { }
+            CLOSE  
+           { end_element(ELT_SUB_REPO_CALN, PARENT, $<ctxt>5, NULL);
+           }
           ;
 
 caln_subs : /* empty */
@@ -2223,7 +3224,16 @@ caln_sub  : caln_medi_sect  { OCCUR2(MEDI, 0, 1) }
           ;
 
 caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item    
-                 { START(MEDI, NULL) } no_std_subs { CHECK0 } CLOSE { }
+                 { $<ctxt>$ = start_element(ELT_SUB_REPO_CALN_MEDI,
+                                           PARENT, $1, $3, $4,
+                                           GEDCOM_MAKE_STRING($4));
+                  START(MEDI, $<ctxt>$)  
+                }   
+                no_std_subs   
+                { CHECK0 }   
+                CLOSE   
+                { end_element(ELT_SUB_REPO_CALN_MEDI, PARENT, $<ctxt>5, NULL);
+                }
                ;
  
 /* SPOUSE TO FAMILY LINK */
@@ -2231,10 +3241,16 @@ spou_fam_link_sub : spou_fam_fams_sect  /* 0:M */
                   ;
 
 spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer
-                     { START(FAMS, NULL) }
+                     { $<ctxt>$ = start_element(ELT_SUB_FAMS,
+                                               PARENT, $1, $3, $4,
+                                               GEDCOM_MAKE_STRING($4));
+                      START(FAMS, $<ctxt>$) 
+                     }
                      spou_fam_fams_subs
                     { CHECK0 }
-                     CLOSE { }
+                     CLOSE 
+                     { end_element(ELT_SUB_FAMS, PARENT, $<ctxt>5, NULL);
+                    }
                    ;
 
 spou_fam_fams_subs : /* empty */
@@ -2265,13 +3281,14 @@ no_std_rec  : user_rec /* 0:M */
 
 user_rec    : OPEN DELIM opt_xref USERTAG 
               { if ($4[0] != '_') {
-                 gedcom_error("Undefined tag (and not a valid user tag): %s",
+                 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
                               $4);
                  YYERROR;
                }
              }
               opt_value
-              { $<ctxt>$ = start_record(REC_USER, $1, $3, $4);
+              { $<ctxt>$ = start_record(REC_USER,
+                                       $1, GEDCOM_MAKE_STRING($3), $4);
                START($4, $<ctxt>$)
              }
              user_sects
@@ -2281,13 +3298,14 @@ user_rec    : OPEN DELIM opt_xref USERTAG
             ;
 user_sect   : OPEN DELIM opt_xref USERTAG 
               { if ($4[0] != '_') {
-                 gedcom_error("Undefined tag (and not a valid user tag): %s",
+                 gedcom_error(_("Undefined tag (and not a valid user tag): %s"),
                               $4);
                  YYERROR;
                }
              }
               opt_value
-              { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6, $6);
+              { $<ctxt>$ = start_element(ELT_USER, PARENT, $1, $4, $6,  
+                                        GEDCOM_MAKE_NULL_OR_STRING($6));
                START($4, $<ctxt>$);
              }
              user_sects
@@ -2313,14 +3331,14 @@ line_value  : POINTER        { $$ = $1; }
             | line_item        { $$ = $1; }
             ;
 
-mand_pointer : /* empty */ { gedcom_error("Missing pointer"); YYERROR; }
-             | DELIM POINTER { gedcom_debug_print("==Ptr: %s==\n", $2);
-                              $$ = $2; }
+mand_pointer : /* empty */ { gedcom_error(_("Missing pointer")); YYERROR; }
+             | DELIM POINTER { gedcom_debug_print("==Ptr: %s==", $2);
+                               $$ = $2; }
              ;
 
-mand_line_item : /* empty */ { gedcom_error("Missing value"); YYERROR; }
-               | DELIM line_item { gedcom_debug_print("==Val: %s==\n", $2);
-                                  $$ = $2; }
+mand_line_item : /* empty */ { gedcom_error(_("Missing value")); YYERROR; }
+               | DELIM line_item { gedcom_debug_print("==Val: %s==", $2);
+                                   $$ = $2; }
                ;
 
 opt_line_item : /* empty */ { }
@@ -2338,9 +3356,11 @@ line_item   : anychar  { size_t i;
                             *line_item_buf_ptr++ = $1[i];
                         $$ = line_item_buf;
                        }
-            | ESCAPE   { CLEAR_BUFFER(line_item_buf);
+            | ESCAPE   { size_t i;
+                         CLEAR_BUFFER(line_item_buf);
                         line_item_buf_ptr = line_item_buf;
-                        /* For now, ignore escapes */
+                        for (i=0; i < strlen($1); i++)
+                          *line_item_buf_ptr++ = $1[i];
                         $$ = line_item_buf;
                       }
             | line_item anychar
@@ -2354,7 +3374,9 @@ line_item   : anychar  { size_t i;
                    $$ = line_item_buf;
                  }
             | line_item ESCAPE
-                  { /* For now, ignore escapes */
+                  { size_t i;
+                   for (i=0; i < strlen($2); i++)
+                     *line_item_buf_ptr++ = $2[i];
                    $$ = line_item_buf;
                  }
             ;
@@ -2386,7 +3408,7 @@ gen_rec_norm : OPEN DELIM opt_xref anystdtag
              ;
 
 gen_rec_top : OPEN DELIM anytoptag
-              { gedcom_error("Missing cross-reference"); YYERROR; }
+              { gedcom_error(_("Missing cross-reference")); YYERROR; }
               opt_value opt_sects CLOSE
                 { }
             ;
@@ -2549,13 +3571,13 @@ void push_countarray()
 {
   int *count = NULL;
   if (count_level > MAXGEDCLEVEL) {
-    gedcom_error("Internal error: count array overflow");
+    gedcom_error(_("Internal error: count array overflow"));
     exit(1);
   }
   else {
     count = (int *)calloc(YYNTOKENS, sizeof(int));
     if (count == NULL) {
-      gedcom_error("Internal error: count array calloc error");
+      gedcom_error(_("Internal error: count array calloc error"));
       exit(1);
     }
     else {
@@ -2600,7 +3622,7 @@ void pop_countarray()
 {
   int *count;
   if (count_level < 0) {
-    gedcom_error("Internal error: count array underflow");
+    gedcom_error(_("Internal error: count array underflow"));
     exit(1);
   }
   else {
@@ -2640,6 +3662,7 @@ int gedcom_debug_print(char* s, ...)
     va_start(ap, s);
     res = vfprintf(trace_output, s, ap);
     va_end(ap);
+    fprintf(trace_output, "\n");
   }
   return(res);
 }
@@ -2660,9 +3683,8 @@ void gedcom_set_compat_handling(int enable_compat)
 void set_compatibility(char* program)
 {
   if (compat_enabled) {
-    gedcom_debug_print("==== Program: %s\n", program);
     if (! strncmp(program, "ftree", 6)) {
-      gedcom_warning("Enabling compatibility with 'ftree'");
+      gedcom_warning(_("Enabling compatibility with 'ftree'"));
       compatibility = C_FTREE;
     }
     else {