[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

  • From: "Roger L. Costello" <costello@m...>
  • To: xml-dev@l..., xerces-j-dev@x...
  • Date: Sun, 03 Sep 2000 13:00:25 -0400

xml simpletype extension
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.