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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

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

[ Lists Home | Date Index | Thread Index ]
  • From: Eric van der Vlist <vdv@dyomedea.com>
  • To: "Roger L. Costello" <costello@mitre.org>
  • Date: Sun, 03 Sep 2000 19:10:48 +0200

Roger,

Yes, I think your derivation is legal and you have a similar example in
the XML Schema Primer
(http://www.w3.org/TR/xmlschema-0/#complexTfromSimpleT).

I have found that the most reliable schema validator is XSV, which is
available as a web service:

http://www.w3.org/2000/06/webdata/xsv

Why wouldn't give it a try ?

Hope this helps,

Eric

"Roger L. Costello" wrote:
> 
> 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

-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------




 

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

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