[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
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|