Add Attributes To A Simpletype Or Restriction To A Complextype In Xml Schema
Answer : To add attributes you have to derive by extension, to add facets you have to derive by restriction. Therefore this has to be done in two steps for the element's child content. The attribute can be defined inline: <xsd:simpleType name="timeValueType"> <xsd:restriction base="xsd:token"> <xsd:pattern value="\d{2}:\d{2}"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="timeType"> <xsd:simpleContent> <xsd:extension base="timeValueType"> <xsd:attribute name="format"> <xsd:simpleType> <xsd:restriction base="xsd:token"> <xsd:enumeration value="seconds"/> <xsd:enumeration value="minutes"/> <xsd:enumeration value="hours"/> </xsd:restriction> </xsd:simpleType> </xsd:attribu