Add headings and paragraphs

We will now generate a documentation for each class of the UML model. First we add a title for a second chapter:

  1. After the comment tag, type the text "Classes"
  2. Apply the style Heading 1 to this text.

[#parameters]in model : uml21[/#parameters]
[#file]result.xml[/#file]
 
Introduction
This document is generated using MDWorkbench.
[#comment]This is a comment, not part of the output[/#comment]  
Classes

Now we will use a foreach tag to iterate on classes:

Now we will use a foreach tag to iterate on classes:

  1. Open the Doc template Assistant window.
  2. In the directives page, drag and drop foreach to your document.
  3. Replace the expr word by "class in model.getInstances("Class")" (apply the style MDW_Expression).
  4. After foreach first tag, type "Class" and apply the style Heading 2.
  5. Insert the tag print.
  6. Inside print, type "class.name".

[#parameters]in model : uml21[/#parameters]
[#file]result.xml[/#file]
 
Introduction
This document is generated using MDWorkbench.
[#comment]This is a comment, not part of the output[/#comment]  
Classes
[#foreach class in model.getInstances("Class")] Class
${class.name}
[/#foreach]

Here we ask for instances of type "Class" in the UML model, and we iterate on these classes using a variable class.

The print tag is used to evaluate an expression and to print the result in the document. Here we insert in the document the name of the class. The style used inside the print tag is essential: this is the style used to print the result of the evaluated expression. Here we use Heading 2.

Related reference
Model APIs
foreach tag
print tag