10.3. An Example of a Simple Type Derived from a User-derived Simple Type

The two previous examples demonstrate simple types derived from the built-in token type. Listing 10.3 portrays the assemblyPartNumberType derived from the partNumberType that is declared in Listing 10.2.

Listing 10.3. Restricting a User-derived Simple Type (catalog.xsd)
 <xsd:simpleType name="assemblyPartNumberType" final="#all" id="catalog.assemblypartNumber.sType"> <xsd:annotation> <xsd:documentation xml:lang="en"> An "assembly" represents a pre-built collection of unit items. The part number for an assembly always starts with "ASM." </xsd:documentation> </xsd:annotation> <xsd:restriction base="partNumberType"> <xsd:pattern value="ASM\d{1,8}"/> </xsd:restriction> </xsd:simpleType> ...

Get XML Schema Complete Reference, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.