OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   XML Schemas: deriving by extension from a user-defined simpleType

[ 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

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"/>

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"/>

Now, let me modify the above cost declaration to reference this new

<element name="cost">
    <complexType base="t:money" derivedBy="extension">
        <attribute name="currency" type="string" use="required"/>

(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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS