[
Lists Home |
Date Index |
Thread Index
]
- From: "Roger L. Costello" <costello@mitre.org>
- To: xml-dev@lists.xml.org, xerces-j-dev@xml.apache.org
- Date: Sun, 03 Sep 2000 13:00:25 -0400
Hi Folks,
I have a question about deriving by extension from a user defined
simpleType.
Suppose that I would like to create a schema for this:
<cost currency="USD">41.95</cost>
Here is one approach:
<element name="cost">
<complexType base="decimal" derivedBy="extension">
<attribute name="currency" type="string" use="required"/>
</complexType>
</element>
The disadvantage of this approach is that it allows <cost> to contain
any decimal value. Suppose that we want to restrict it to contain a
decimal value with no more than two digits to the right of the decimal
point. Here is a simpleType to define a restricted decimal:
<simpleType name="money" base="decimal">
<scale value="2"/>
</simpleType>
Now, let me modify the above cost declaration to reference this new
type:
<element name="cost">
<complexType base="t:money" derivedBy="extension">
<attribute name="currency" type="string" use="required"/>
</complexType>
</element>
(Let's assume that "t" has been set to the targetNamespace)
Is this second version of cost legal? Can we derive (by extension) from
a user defined simpleType?
I have found that the Apache 1.2 parser does not accept the second
version, whereas it does accept the first version. /Roger
|