8 ms·
There's a semantic difference between an element and an attribute. Unfortunately, XML is specifically used to model element-as-attribute relationships, so a lot
by sesqu 16y ago
There's a semantic difference between an element and an attribute. Unfortunately, XML is specifically used to model element-as-attribute relationships, so a lot of people start wondering about the exact, nebulous, distinction. Elements are the more flexible of the two, but possessing of some quality that you (and many others) wish to avoid.
The difference is much the same as that between native datatypes and objects. Some languages explicitly expose everything as objects, while others contend that, for example, boolean-objects are overkill and downright problematic.
Generally, I use attributes for strongly typed data, and elements for untyped or (semi)structured data. Schemas are vital for typing.