As a global type:
<xs:schema targetNamespace="..."> <xs:simpleType name="myType">...</xs:simpleType> </xs:schema>
Inside an element or attribute declaration:
<xs:schema targetNamespace="..."> <xs:element name="data"> <xs:simpleType>...</xs:simpleType> </xs:element> <xs:complexType name="ElementWithAttribute"> <xs:attribute name="href"> <xs:simpleType>...</xs:simpleType> </xs:attribute> </xs:complexType> </xs:schema>