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.


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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:07 UTC