So i have an element phone
<phone carrier="A">9991234567</phone>
with a carrier
attribute with defined values. I've defined it using complexType. Now, the content of the phones also needs to have a restriction (Regex).
<xs:element name="phone" type="phoneType" />
<xs:complexType name="phoneType">
<xs:attribute name="carrier" type="carrierType" />
</xs:complexType>
<xs:simpleType name="carrierType">
<xs:restriction base="xs:string" >
<xs:enumeration value="A" />
<xs:enumeration value="B" />
</xs:restriction>
</xs:simpleType>