A node in the content repository must be of a single type, but may be attached to one or more aspects. The aspects are either inherited from its type (as defined in the content model), or can be attached or detached at runtime, allowing a node to dynamically inherit features and capabilities.
<xs:element name="model"> ... <xs:element name="aspects" maxOccurs="1"minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="aspect" type="aspect"maxOccurs="unbounded" minOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element> ... </xs:element>
Aspects support all the same features as types, and therefore are defined in the same way as types.
<xs:complexType name="aspect"> <xs:complexContent> <xs:extension base="class" /> </xs:complexContent> </xs:complexType>
As with the type definition, an aspect definition is simply a derivation of the schema definition named class. This means that an aspect shares all the same features as a class, including property, association, and constraint definitions. Aspects may inherit from parent aspects and support property overrides.
An aspect may be attached to one or more types. This means that a node created of that type automatically inherits the attached aspects.
<xs:complexType name="class"> ... <xs:element name="mandatory-aspects" maxOccurs="1" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="aspect" type="string" maxOccurs="unbounded" minOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element> ... </xs:complexType>
To attach an aspect, specify the name of the aspect to attach in the aspect element of the source type. This feature is available at the class level, allowing aspects to be attached to other aspects as well as types.