[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Attributes v Elements
- From: Iain W Fergusson <email@example.com>
- To: firstname.lastname@example.org
- Date: Thu, 17 May 2001 11:25:19 +0100
>> Most times there is no definitive answer, it comes down to your
>> preference. I would refer to the FAQ that Robin mentioned.
>This answer is completely bogus.
IMO there is no definitive answer. Your suggestion is not definitive.
For one thing, it prevents full use of XML Schema.
>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:
In the above example <price> has to be described in XML Schema using a
<complexType>, because of the presence of the currency attribute.
There is then no way of constraining the contents of <price> to be a number.
If you need to validate that <price> is a number, it has to be a <simpleType>,
which cannot have attributes.
>Please never use your element example:
>The element "<type>" should not exist as such becuase it is an adjective
>describing currency. You would probably not use the "<type>" element all by
>itself in your document becuase it is dependant.
Good example - because <value> can be described using a <simpleType>, so can be
I'm not suggesting that XML Schema is perfect, just that there is no single
the attributes vs. elements questions that is right in all situations.
JP Morgan European Technology Centre.
This communication is for informational purposes only. It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.