Posted by: Rajesh Kanaparti | April 27, 2008

Attribute VS Elements, its tricky

I work with XML a lot and often I come up with the question where I should go with Attributes or Elements.Most often i judge my decision based on the following opinions that I came across Google searches.

Attributes Elements
Used for holding meta-data (data about data, ex. ID numbers,information irrelevant to the users) Used for holding data
(information user wants to see)
Can only be defined by a data type Can be defined by a
data type,attributes, and structures (this makes them more extensible)
Not expandable for future changes (can only change its
data type)
Can add more attributes, change the data type or change its
structure
Cannot have multiple occurrences Allows for multiple
occurrences
Independent of ordering Dependent on positional
ordering

Please feel free to add on your opinions.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Categories

%d bloggers like this: