Most of the types I've used in ch05_07.xsd are simple types that come built into the XML schema specification, such as xsd:string , xsd:integer , xsd:date , and so on. However, take a look at the attribute named bookID : this attribute is declared to be of the type catalogID : <xsd:complexType name="books"> <xsd:sequence> <xsd:element name="book" minOccurs="0" maxOccurs="10"> <xsd:complexType> <xsd:sequence> <xsd:element name="bookTitle" type="xsd:string"/> <xsd:element name="pubDate" type="xsd:date" minOccurs='0'/> <xsd:element name="replacementValue" type="xsd:decimal"/> <xsd:element name="maxDaysOut"> <xsd:simpleType> <xsd:restriction base="xsd:integer"> <xsd:maxExclusive value="14"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> <xsd:attribute name="bookID" type="catalogID"/> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> This type, catalogID , is itself a simple type that is not built into the XML schema specification; instead, I've defined it with the <simpleType> element like this: <xsd:simpleType name="catalogID"> <xsd:restriction base="xsd:string"> <xsd:pattern value="\d{3}-\d{4}-\d{3}"/> </xsd:restriction> </xsd:simpleType> Note in particular that you must base new simple types such as catalogID on already existing simple type (either a built-in simple type or one you've createdhere, I'm using the built-in xsd:string type). To do that, you use the base attribute in the <xsd:restriction> element. In the case of the catalogID type, I've based it on the xsd:string type with the attribute/value pair base="xsd:string" . To describe the properties of new simple types, XML schemas use facets. |