This is where things get a little tricky. We are now restricting an existing xs:complexType. Our SolidStateDriveType derives from HardDiskType but removes the spinUpTime attribute and the RotationSpeed element.
Notice the approach for dealing with attributes and elements is different. To remove an attribute you need to re-declare it and set its use to prohibited. For elements simply not re-declaring them will cause them to be excluded, in fact you need to re-declare any elements you want to keep in the new type.
Key concept for restricted types : It must be possible to load an XML instance element resulting from the restricted type into the base type, put another way the restricted type needs to be able to 'fit' into the base type. So you can not exclude a mandatory attribute or element, in order to exclude it in the restricted type it must be optional in the base type. If you change the type/facet rules of an element or attribute in the restricted type, the new type/facet rules must be compatible with the base type, so if the base type was a short, the restricted type could be a byte, but not a long.
<?xml version="1.0" encoding="utf-8" ?> <!--Created with Liquid Studio 2017 - Developer Bundle Edition (Trial) 184.108.40.20692 (https://www.liquid-technologies.com)--> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="HardDiskType"> <xs:sequence> <xs:element name="Capacity" type="xs:long" /> <xs:element name="RotationSpeed" type="xs:int" minOccurs="0" /> </xs:sequence> <xs:attribute name="name" type="xs:string" /> <xs:attribute name="spinUpTime" type="xs:time" /> </xs:complexType> <xs:complexType name="SolidStateDrive"> <xs:complexContent> <xs:restriction base="HardDiskType"> <xs:sequence> <xs:element name="Capacity" type="xs:long" /> </xs:sequence> <xs:attribute name="spinUpTime" use="prohibited" /> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:schema>