I am developing some xsd and it contains a number of identifiers to shared master data by ID. I am not keen to just identify these as positiveInteger nor to create an extra level of indirection and would rather define my own type where I simply rename positiveInteger
My question is, is the following legitimate?
<xs:complexType name="masterDataKey">
<xs:simpleContent>
<xs:extension base="xs:positiveInteger" />
</xs:simpleContent>
</xs:complexType>
and if not then what options are open to me.
Cheers, Daryl
Well, your example isn't a simple renaming. You've created a complexType, whereas xs:positiveInteger is a simpleType, so you won't be able to use it for example as the type of an attribute (which has to be simple).
It's probably better to define a trivial restriction:
<xs:simpleType name="masterDataKey">
<xs:restriction base="xs:positiveInteger" />
</xs:simpleType>
But even then you need to be aware that your type isn't a simple alias for xs:positiveInteger; for example a type that's derived from positiveInteger won't be substitutable for masterDataKey.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With