Lists Home |
Date Index |
- From: Newsha Makooi <Newsha@imrgold.com>
- To: 'Sebastien Clement' <email@example.com>, firstname.lastname@example.org
- Date: Tue, 05 Sep 2000 15:53:38 -0600
Title: RE: Attributes VS Elements
Should you avoid using attributes?
Here are some of the problems using attributes:
-attributes can not contain multiple values (elements can)
-attributes are not easily expandable (for future changes)
-attributes can not describe structures (child elements can)
-attributes are more difficult to manipulate by program code
-attribute values are not easy to test against a DTD
-If you use attributes as containers for data, you end up with documents that are difficult to read and maintain. Try to use elements to describe data. Use attributes only to provide information that is not relevant to the data.
An Exception to the Attribute rule, because rules always have exceptions!
Sometimes you need to assign ID references to elements. These ID references can be used to access XML elements in much the same way as the NAME or ID attributes in HTML. In such cases the ID can be used as an attribute.
You can read more on this @ http://www.w3schools.com/xml/xml_attributes.asp
Hope this helps.
From: Sebastien Clement [mailto:email@example.com]
Sent: Tuesday, September 05, 2000 1:49 PM
Subject: Attributes VS Elements
Is there a good resource, or a best practices article, on when to use
elements versus attributes in an XML document?
Web Systems Architect - CBC/Radio-Canada