loading table of contents...

4.2. Creating Content Type Definitions

In CoreMedia CMS you define your content type definitions in XML files. CoreMedia CMS allows you to administrate content type definitions modularly. That means, that content types can be defined in different independent files, instead of one monolithic file. The Content Server loads and combines all content type files which match a given pattern. You can define the pattern in the cap.server.documentTypes property in the contentserver.properties file (see Section 5.1, “Configuration in contentserver.properties” for details).

Schema of content type definitions

Figure 4.1. Schema of content type definitions


You can also link from one content type file to content types and grammars defined in other files.

Examples:

In this example, the content type BaseDocument and the grammar mycompany-richtext are defined in the base-doctypes.xml file and are also used in the specific-doctypes.xml file. To this end, both are imported using the <ImportDocType> and <ImportGrammar> elements.

<DocumentTypeModel xmlns="http://www.coremedia.com/2009/documenttypes"
  xmlns:extensions="http://www.coremedia.com/2013/documenttypes-extensions"
  Name=“Base-Doctypes“>

 <XmlGrammar Name="mycompany-richtext" Root="company"
    PublicId="-//MyCompany//DTD Richtext 1.0//EN"
    SystemId="lib/xml/mycompany-richtext.dtd"/>

 <DocType Name="BaseDocument" Abstract=“true“>
  <StringProperty Name="Titel" Length="200"/>
 </DocType>

</DocumentTypeModel>

Example 4.1. The base-doctypes.xml file


<DocumentTypeModel xmlns="http://www.coremedia.com/2009/documenttypes"
  xmlns:extensions="http://www.coremedia.com/2013/documenttypes-extensions">

 <ImportDocType Name="BaseDocument" From="Base-Doctypes"/>
 <ImportGrammar Name="mycompany-richtext" From="Base-Doctypes"/>

 <DocType Name="Text" Parent="BaseDocument">
  <XmlProperty Name="Text" Grammar="mycompany-richtext"/>
 </DocType>

</DocumentTypeModel>

  

Example 4.2. The specific-doctypes.xml file