0

Possible Duplicate:
XML attribute vs XML element

I was informed to use attributes for metadata and elements for data. I was wondering what are the benefits of separating elements from attributes. Are attributes processed differently than the elements in XML?

Thanks, Mohmd.

Community
  • 1
  • 1
Moeman
  • 81
  • 1
  • 3
  • How they are processed depends entirely on how you define them? There is no rule on how to process an xml but its definition (xsd). – Jacob Aug 08 '11 at 11:10

1 Answers1

-1

Some of the problems with attributes are:

  • attributes cannot contain multiple values (child elements can)
  • attributes are not easily expandable (for future changes)
  • attributes cannot describe structures (child elements can)

Metadata (data about data) should be stored as attributes, and that data itself should be stored as elements.

Reference: http://www.w3schools.com/DTD/dtd_el_vs_attr.asp

Community
  • 1
  • 1
Kirill Polishchuk
  • 54,804
  • 11
  • 122
  • 125