Item description data in XML (XML)

Robert A. (Bob) Morris ram at CS.UMB.EDU
Tue Nov 30 10:15:52 CET 1999


[Forgive me if this duplicates. My mailer claims I sent it, but I
never got it and I don't see it in the archives]


Gregor Hagedorn writes:
 >
 > It is difficult to add information about obovate or length. Noel
 > already noted that we may be running into this "properties of
 > properties" problem.
 >
 > General question: Is there any reason why attributes exist at all?
 > What is the advantage of
 >
 > <leaf shape="obovate" length_mm="31"/>
 >
 > over
 >
 > <leaf>
 >  <shape>obovate</shape>
 >  <length>31</length>
 >  <MeasurementUnit>mm</MeasurementUnit>="
 > </leaf>
 >


Popular wisdom often asserts there is no difference, but there are
important differences for database work which are less so (except 1
below) for documents (hence the popular wisdom). These things are true
of attributes in XML but not necessarily of elements (the tags + stuff
between them) depending on the grammar defining the vocabulary:

1. Attributes are order independent

2. There can only be one attribute,value pair for each attribute.

3. With DTD's (which are the wrong thing to consider here but
that is another story), you can enumerate the permitted values of
attributes. You can work around this for elements but it may be
pointless, verbose, and fragile, especially because of the order
dependence of elements.

4. (Subtle and technical)References to XML objects essentially must appear as
attributes. This is the only way you can get non-tree graph structure
in XML documents, and also is the way you would make a data value
conveniently be another object. So if "obvate" were actually some
complex object that held more information, you would probably find it
named as the value of an "idref", not as text data.
While specimen and species documents may prove to representable by
trees, keys probably will not be.




More information about the tdwg-content mailing list