Re: Item description data in XML (XML)
On Tue, 30 Nov 1999, Gregor Hagedorn wrote:
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>
In general a tag can provide the same function as an attribute, as in the case you mention, but there are some situations where attributes are useful. For example, in cases where text is being marked up and the text itself cannot be altered, new data can be stored in attributes.
In this case country IDs can added without altering the text:
"They can be found in <country id="EN">England</country> and in <country id="IT">Italy</country>."
Also in cases where you don't want your tagged items to be rendered by a browser. For example, if you add some RDF metadata:
rdf:RDF <rdf:Description about="http://www.veggies.org/carrot.jpg%22%3E <s:Family>Apiaceae</s:Family> </rdf:Description> </rdf:RDF>
The this case the word "Apiaceae" would be rendered in the page, while in this case:
rdf:RDF <rdf:Description about="http://www.veggies.org/carrot.jpg" s:Family="Apiaceae" </rdf:RDF>
the word "Apiaceae" would not appear in the page.
There are probably more fundamental differences that Liegh, Bob, and others could come up with -- these are just two that come to mind.
Best, -Noel
participants (1)
-
Noel Cross