From: Hans Fugal Date: 2004-11-06T08:53:41+09:00 Subject: Re: [QUIZ] GEDCOM Parser (#6) Jim Menard wrote: >> >> >> >> Buck >> Jamis Gordon >> >> M >> ... >> >> ... >> > > > What determines whether the value should be an attribute or a > sub-element? It's not level because, for example, sex and name are at > the same level but name's value is an attribute where sex's is a text > sub-element. > > Is the rule that the value should be an attribute only if the element > has children? > > Jim As one of the other GEDCOM experts in the house let me reinforce Jamis' pleas that you just have fun and don't worry about the details. GEDCOM really isn't worth the effort unless you want to interoperate with other genealogical software. It is generally regarded as a dated and flawed format, however a practical alternative has yet to emerge. I take issue with the example XML in the quiz because I am from the "data in text, metadata in attributes" camp, and the name is not metadata. Here is a snippet of the output that I am generating: Itha /Steele/Steele Itha F <_UID>38CC16658231D511ACB8E07C9CE21378E1AF @F12@ @F4@ But the way I read the quiz we didn't have to emit a certain kind of XML, we just had to emit sensible XML. Certainly Jamis didn't give enough data to fully specify the XML output, as you will see if you pull up the GEDCOM spec and ponder the many subtleties therein (as I see some of you may have begun to do). The /Fugal/ thing is a convention in genealogy. You'll notice that the SURN tags don't have the //, just the surname in the NAME tags. It's not a requirement of GEDCOM by any means, just a convention. An older (and uglier, IMHO) convention is to capitalize the surname. In either case I as a genealogist would consider your software to be doing the Wrong ThingTM if you changed my data from the way I had entered it. Genealogists are very sensitive to data integrity, in part because GEDCOM implementations aren't very faithful or interoperative. A syntactic parsing of GEDCOM is very easy, but a semantic parsing is more difficult than you would want to deal with for a quiz. Enjoy! Hans