[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Attributes v Elements
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@x...> To: "Paul Cody Johnston" <pcj@i...>; "Conder, Tom D (N-MAXIM Group)" <tom.d.conder@l...> Cc: <xml-dev@l...> 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. > ...
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|