[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Attributes v Elements
- From: Mike_Leditschke@nemmco.com.au
- To: Iain W Fergusson <firstname.lastname@example.org>
- Date: Thu, 17 May 2001 21:41:10 +1000
Not sure if I misunderstood you but I think XML Schema CAN
constrain the contents of <Price> as well as specifying it to
have an attribute - there is a very similar
example in section 2.5.1 of the primer.
Iain W Fergusson
<fergusson_iain@jpm To: email@example.com
organ.com> cc: Pcj@Inxar.Org, Tom.D.Conder@Lmco.Com, firstname.lastname@example.org
Subject: Re: Attributes v Elements
17/05/2001 08:25 PM
>> 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
If you need to validate that <price> is a number, it has to be a
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
>itself in your document becuase it is dependant.
Good example - because <value> can be described using a <simpleType>, so
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
an offer or solicitation for the purchase or sale of any financial
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
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.
The xml-dev list is sponsored by XML.org, an initiative of OASIS
The list archives are at http://lists.xml.org/archives/xml-dev/
To unsubscribe from this elist send a message with the single word
"unsubscribe" in the body to: email@example.com