Reputation: 2185
In an XML Schema Definition (XSD) document, according to this, one can have a simpleType element containing a restriction element that may have another simpleType element.
I have browsed many restriction / simpleType related pages including the W3 Schema Primer, yet I have not been able to find a simple explanation of how this should be interpreted by an XSD processor. I get what a simpleType is, I get most of its possible restrictions, but I can't quite figure out what a simpleType/restriction/simpleType construction is supposed to mean. How is this commonly / typically used by schema designers?
Upvotes: 1
Views: 182
Reputation: 12187
It's an alternative to base=""
. Similar to an <element>
having either type=""
or a <complexType>
(but not both nor neither).
{base type definition} The Simple Type Definition component resolved to by the actual value of the
base
[attribute] or the<simpleType>
[children], whichever is present.
http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#derivation-by-restriction
Upvotes: 2
Reputation: 163458
XSD generally allows one definition to refer to another either by name (ref=NNNN), or by embedding the other definition inline. I can't see any strong reason use this mechanism for defining the base type of a type derived by restriction, but it's there for generality and consistency. (And just because I can't see a use for it doesn't mean there isn't one...)
Upvotes: 2