A uniqueness constraint is specified within the element declaration--not the complex type definition.
A uniqueness constraint can be specified for optional content.
It is specified by the 'unique' element--which has a 'name' attribute and contains a 'selector' and one or more 'field' elements.
A declaration:
<xs:unique name="product-name"> <xs:selector xpath="."/> <xs:field xpath="name"/> </xs:unique>