Publisher and Web Interface > Publisher > Developing document definitions > Overview of developing document definitions (Publisher) > Worked example: extracting items through model item types (Publisher)
  
Worked example: extracting items through model item types (Publisher)
This is one of five worked examples that relate to developing document structures:
Worked example: extracting items through model item types
Worked example: extracting items through child roles and child types
Worked example: extracting items through extended model item types (stereotypes)
Worked example: extracting diagrams and their items
Worked example: extracting specific items
This worked example demonstrates use of a model item type to extract items from a model. In addition, this example demonstrates how to define which item properties are extracted. This example uses the Word output format.
In this worked example, we create a document definition that extracts all the Classes in a model, including the Description property of each Class.
This example uses the following model:
Each item in the model has its Description property set to 'Description of the <item name> <item type>'. For example, 'Description of the Dispenser Display class'.
Defining the extraction of classes
In this example, we start by opening the publication model in Modeler, and creating a new empty Document Definition.
We ensure that Publisher is showing all the panes required to define a Document Definition by clicking the Full Editor Layout toolbar button.
We want our generated document to have a heading for each Class in the model and we want each heading to be followed by the Class description; so we need to add a Class model item type to our document structure. Adding a Class model item type to our document definition will extract all Classes from the model.
To do this, we select the Body icon in the document structure, click the Add Modeler Dictionary Item Section button, and then select the Class model item type.
We now have a document structure item that has a Class assigned to it.
We generate the document and the following text appears in the Word document.
Note that if our model had additional Classes, there would be a heading for each Class.
We want to make the following changes:
We want to change the first heading from 'CLASS' to 'CLASSES IN THE MODEL'.
We want only the Description property to be generated and we do not want the description prefixed with 'Description:'
We change the first heading from 'CLASS' to 'CLASSES IN THE MODEL' by selecting the Class in the document structure, and then in the Properties pane changing the Title Text property from 'Class' to 'Classes in the model'.
In the Properties pane, we can see that the Name, FullScopedName, Description and DynamicUmlClassName properties are extracted.
We remove the Name property by selecting it and clicking the Delete Item button. We remove the FullScopedName and DynamicUmlClassName properties in the same way.
We do not want the description to be prefixed with the name of the property (Description), so we set the Description property's Generate Label property to Don't Generate.
We generate the document again and the text is now as we want it: the CLASS heading now states CLASSES IN THE MODEL, and only the Description property is extracted without being preceded by the name of the property.
In this worked example, we have demonstrated how to extract items through their model item type.
In the next worked example, we develop the document structure using child roles and child types. Worked example: extracting items through child roles and child types (Publisher)