<!-- example --> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Audi"/> <xs:enumeration value="Golf"/> <xs:enumeration value="BMW"/> </xs:restriction> </xs:simpleType> <!-- example --> <xs:complexType name="personinfo"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="fullpersoninfo"> <xs:complexContent> <xs:extension base="personinfo"> <xs:sequence> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <!-- example --> <element name="callMyApp" type="dc:processingHook" /> <callMyApp/>
https://www.w3.org/TR/xmlschema-2/#built-in-datatypes http://www.xml.com/pub/a/2001/08/22/easyschema.html -> best article That leaves us with <complexType> with <complexContent>, which ensures that there will not be any data content in the element.
<complexType name="processingHook"> <complexContent> <restriction base="xs:anyType"> -> the default syntax for complex types is complex content that restricts anyType </restriction> </complexContent> </complexType> <complexType name="processingHook"></complexType> <!-- example --> <product prodid="1345" /> <xs:element name="product"> <xs:complexType> <xs:complexContent> <xs:restriction base="xs:anyType"> <xs:attribute name="prodid" type="xs:positiveInteger"/> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:element> <xs:complexType name="prodtype"> <xs:attribute name="prodid" type="xs:positiveInteger"/> </xs:complexType> <!-- example -->
http://stackoverflow.com/questions/5457217/xsd-for-simplecontent-with-attribute-and-text Apparently, you can't restrict simpleContent within a complexType, only extend it.
<shoesize country="france">35</shoesize> <xs:complexType name="shoetype"> <xs:simpleContent> <xs:extension base="xs:integer"> <xs:attribute name="country" type="xs:string" /> </xs:extension> </xs:simpleContent> </xs:complexType> <!-- example --> <marks>95</marks> <xs:element name="marks"> <xs:simpleType> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="100"/> </xs:restriction> </xs:simpleType> </xs:element>