Reputation: 49
Hey I was just going through some article on XML, I came across the following snippet of code
<xs:element name="shirtSize">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:enumeration value="36"/>
<xs:enumeration value="40"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
I was wondering what base keyword means in the line
<xs:restriction base="xs:int">
Can anyone please explain me what it means?? Thanks
Upvotes: 2
Views: 913
Reputation: 163575
This element declaration specifies that the type of the element is an anonymous type formed as a restriction of the built-in type xs:int, the restriction being that the only allowed values are 36 and 40. The attribute name "base" is used in xs:restriction to name the type that is being restricted.
Upvotes: 0
Reputation: 18064
On base attribute, you can specify
xs:int
, xs:string
, xs:long
and soonYou can do restriction with the following:
• length
• minLength
• maxLength
• pattern
• enumeration
• whiteSpace and some more too based on type
Upvotes: 0
Reputation: 726939
base
is not, strictly speaking, a keyword. It is part of XML Schema (XSD) "language", letting you create simple types by restricting other simple types, including built-in numeric types.
In your case, the integer value is restricted to two values - 36 and 40.
Upvotes: 3