The schema definition for the content type includes various
<xsd:complexType> nodes to define the structure of a content. The complex type that defines the structure of the content for one language, we call the schema type. In the above example, the schema type is named "SimpleExample". The structure of the schema type, and thus of the contents, is defined in the node
<xsd:complexType name="OpenCmsSimpleExample">. In the example, the content has just one (schema) element, named
The above schema definition has a second section wrapped in
xsd:annotation/xsd:appinfo. In this optional section, content specific behavior is specified. In the example, it is configured that the content should not be indexed for searching in its own right, but it can be found in the index via the container pages in which it is placed.
The example highlights the basic structure of a schema definition for a content type. The whole definition is wrapped by the
<xsd:schema> node. This node is always the same for each content type definition. The attributes specify the namespace of the schema definition, i.e., which nodes are available and how they can be nested.
<xsd:schema> node, the content type definition consists of four parts:
- Inclusion of other XSDs. Here it is necessary to include the opencms-xmlcontent.xsd, as done in the example. This XSD exposes the definition of types that are predefined in OpenCms, e.g.,
OpenCmsString in the above example.
Note that the XSD is not a "real" file in the VFS. The include is handled in a special way by OpenCms.
You can include further XSDs here. In particular, you can nest content definitions and make the type of a nested content available via
- Definition of the multi-language wrapper. Content in OpenCms is by default multi-lingual. Each content item can be saved in multiple languages. All language-specific versions are stored in the same XML file. The multi-language wrapper tells us that the content exists in zero to (potentially) unlimited language-specific versions. The wrapper is mandatory and needs to have exactly the structure presented above.
- Definition of the structure of the content for a single language. This part is really specific to your content. In the example, the content has just one element of type
OpenCmsString, i.e., an element that stores a string. Read more about the structure part here.
- Configuration of the content's behavior. Optionally, the content item's behavior can be configured. E.g., you can configure how content elements should appear in the content editor, map content elements to properties, etc., define default values for elements, say how elements should be indexed for the search, and so on. You can read about the various configuration options here.