W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2005

Re: Attribute Usage

From: Bryce K. Nielsen <bryce@sysonyx.com>
Date: Thu, 17 Mar 2005 20:38:45 -0700
Message-ID: <004a01c52b6b$fe44e470$650fa8c0@PREZ>
To: <xmlschema-dev@w3.org>

> What is the purpose of element attribute?  And is there a usage
> rule-of-thumb for element attribute (attribute vs. child element) ?
>

As noted, there is no hard-fast rule. Most programmers I've dealt with tend
to prefer elements over attributes, probably because at first, with DOM,
it's easier to deal with elements than attributes. Probably the best
argument I've heard for elements over attributes is that they can be
extended a lot easier. On the other hand, the best argument for attributes
has got to be size. If you deal in large XML documents (like I do,
converting EDI into XML), then the XML document can be drastically reduced
if you use Attributes for your "fields" (there's only one name per field,
instead of two for the open/close tag of elements).

All in all, I personally prefer using elements over attributes, though see
valid justifications for both, pure and mixed.

HTH,

Bryce K. Nielsen
SysOnyx, Inc. (www.sysonyx.com)
Makers of xmlLinguist, the affordable EDI to XML Translator
http://www.sysonyx.com/products/xmllinguist
Received on Friday, 18 March 2005 03:39:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:49 GMT