[nycphp-talk] Is this XML valid?
David Krings
ramons at gmx.net
Sat Sep 19 18:35:14 EDT 2009
Matt Williams wrote:
> So if the above is valid XML, is there a specific name for this approach? Is there a benefit for doing it this way instead of nested nodes? Might this be considered older method?
>
>
> No, it's not an older method. There is no absolute definition of when to
> use elements versus attributes. There are, however, some attempts at
> defining general principles:
>
> http://www.ibm.com/developerworks/xml/library/x-eleatt.html
The thing is that attributes have less overhead. So if you have many different
elements that have a few properties using attributes shaves off a few
characters. Then again, XML has a gigantic amount of overhead anyway, so why
bother. One could also say that anything mandatory is to be an attribute while
everything else is a sub-element. Haven't looked at the IBM page yet, so maybe
my ideas are not on the money. In general, XML is made for machines to read,
it is not fit for human consumption.
David
More information about the talk
mailing list