[Tcs-lc] [tcs-lc] Question about XML attribute vs. element

Gregor Hagedorn G.Hagedorn at BBA.DE
Tue Mar 22 14:42:58 PST 2005


I fully agree with Bob re taste of using attributes. This is a difficult 
decision.

In SDD we tend to avoid attributes, except for id, refs to ids, and a few basic
things like values. For example, in reusable types where values are kept 
closely together (such as date/time types following the w3c 7 attribute model) 
the data are in attributes. Also, the need for natural language markup forces a 
bit of data into attributes. 

If everything on the same level can be put into attributes or element content, 
attributes are great and nicer to read (of course, nobody ever should read 
xml...). If part of the data on the same conceptual level must be elements and 
others could be attributes, it easily leads to confusion. Attributes and 
element content are always separate parts. So if the schema is simpler to 
understand by humans if data items are arranged in a certain sequence, 
attributes may be surprising.

One criterium is that data items that *may* be structured - even if currently a 
simple type - are best element content rather than attributes. Otherwise over 
time or in different parts of schema inconsistencies creep in.

In SDD, if in doubt, we make it an element. That slightly reduces 
inconsistencies - I am sure there are many left though.

All that said, I don't know wether it should be "NomenCode" element of 
"nomencode" attribute (SDD, ABCD, TCS agreed to use UpperCamelCase for element 
names and totallowercase for attribute names - such a rule simplifies life 
because NomenCode, nomenCode, Nomencode etc. are all different for most 
software.

---

By the way: I don't like Nomencode - it is short but confusing and needs 
explanation. There is no "International code of nomen". To me it feels weird, 
because of the mix of English and Latin grammar; "nomen" must be Latin, in 
English "nomen" is: "an ancient Roman's second name, designating his gens or 
clan. See also agnomen, cognomen, praenomen." Code is English (Latin would be 
"codex"). So NomenCodex would be ok.

NomenclaturalCode is longer, but correct and intuitive. I believe intuition is 
more important than shortening element names. Another matter of taste, of 
course...

Gregor

> Thanks, Bob!
> 
> So....what do you think "NomenCode" should be -- an element, or an attribute
> (for NameDetailed)?
> 
> Rich
----------------------------------------------------------
Gregor Hagedorn (G.Hagedorn at bba.de)
Institute for Plant Virology, Microbiology, and Biosafety
Federal Research Center for Agriculture and Forestry (BBA)
Königin-Luise-Str. 19           Tel: +49-30-8304-2220
14195 Berlin, Germany           Fax: +49-30-8304-2203



More information about the Tcs-lc mailing list