OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: Attributes VS Elements

[ Lists Home | Date Index | Thread Index ]
  • From: Newsha Makooi <Newsha@imrgold.com>
  • To: 'Sebastien Clement' <sclement@nm1.radio-canada.ca>, xml-dev@lists.xml.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.
Newsha

-----Original Message-----
From: Sebastien Clement [mailto:sclement@nm1.radio-canada.ca]
Sent: Tuesday, September 05, 2000 1:49 PM
To: xml-dev@lists.xml.org
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?

----------
Sébastien Clément
Web Systems Architect - CBC/Radio-Canada






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS