[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Attributes v Elements
- From: Jeff Greif <jgreif@alumni.princeton.edu>
- To: xml-dev@lists.xml.org
- Date: Thu, 17 May 2001 03:56:16 -0700
Duane,
I agree with your preferred way of writing the example, but not your
rationale. In English, 'currency' and 'type' are both nouns, not
adjectives. Referring to them as Adjectives seems confusing. What makes
currency more appropriate to use as an attribute is that it is an attribute,
modifier, quality, qualifier, or property of the price which can be
expressed as a single value, potentially with a default. If instead, you
were describing a payment, the currency would again be an attribute, but the
date might be an element to isolate its attributes of year, month, day. The
payer might be an attribute with an id value referring to an element
elsewhere in the document or database, or it would be an inline version of
that element containing the various subelements and attributes of a (perhaps
corporate) person.
Jeff
----- Original Message -----
From: "Duane Nickull" <duane@xmlglobal.com>
To: "Paul Cody Johnston" <pcj@inxar.org>; "Conder, Tom D (N-MAXIM Group)"
<tom.d.conder@lmco.com>
Cc: <xml-dev@lists.xml.org>
Sent: Thursday, May 17, 2001 1:37 AM
Subject: Re: Attributes v Elements
...
> An Element is used for capturing a Noun, capable of standing alone as a
> noun.
>
> An Attribute is an Adjective, describing something unique about the
> instance of the noun (element) and would not normally appear in your
> document by itself without the associated noun (element).
>
> For instance, using your currency example, your first example has two
> adjectives together as both an element and an attribute:
>
> <currency type="USDollar">
> > 10
> > </currency>
>
> You would be better off to use a more definitive description of what the
> monetary value is. "USDollar" is really the value for "Currency". Try
> something like this:
>
> <Price currency="USD">10</Price>
>
> Currency is really an adjective describing something unique about the
price
> that users of your XML would find useful. The "<Price>" element is more
> descriptive of what the PCDATA represents.
> ...