From: Dave Burt Date: 2004-11-06T01:38:44+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 There's a GEDCOM spec at: http://homepages.rootsweb.com/~pmcbride/gedcom/55gctoc.htm It's a bit of a mess, somewhat contradictory... Anyway, XML. For the above, I think I prefer the following to Jamis' example XML: Jamis Gordon /Buck/ Buck .... Interestingly, the sample GED file given doesn't have any names like this, nor even any SURN elements. "Those using the optional name pieces should assume that few systems will process them, and most will not provide the name pieces. " http://homepages.rootsweb.com/~pmcbride/gedcom/55gcch2.htm#PERSONAL_NAME_STRUCTURE It does have: 1 NOTE Line 1 2 CONT Line 2 2 CONT Lin 2 CONC e 3 2 CONT Line 2 CONC 4 and: 1 SOUR @S1@ 2 PAGE 1 .... 0 @S1@ SOUR 1 TEXT Hello I think these are the two interesting cases converting to XML. The CONTinuation tag represents just a continuation of the data in the parent element, as lines are of limited length; it has no semantic value. I think these tags need to be understood by a GEDCOM->XML parser. I'm thinking the above should probably turn out something like: Line 1 Line 2 Line 3 Line 4 The second of the two fragments shows a tag (SOURce) with a value (the link to xref-id @S1@) as well as a sub-tree. Same thing as Jamis' NAME example, also common elsewhere in the spec. The use of the id attribute for ids is obvious, but I'm not sure the value attribute is ideal, especially considering that the spec states that source description (the value of the SOURce tag) may be continued with CONT or CONC, thus may be multi-line. Thus: @S1@ 1 .... Hello