XML Example

Listing 2. This XML representation of the class diagram shown in Figure 1 has a straightforward structure that recalls UML concepts such as classes, attributes, operations, parameters, associations, and roles.

<?xml version="1.0" encoding="UTF-8"?> 
<Content> 

  <Class name="Customer" stereotype=""> 
    <Attribute name="code" type="integer"/> 
    <Attribute name="description" type="string"/> 
  </Class> 

  <Class name="Order" stereotype=""> 
    <Attribute name="number" type="integer"/> 
    <Attribute name="date" type="date"/> 
    <Operation name="getTotalAmount" returnType=
      "double"> 
      <Parameter name="calculateVAT" type=
        "boolean"/> 
    </Operation> 
  </Class> 

  <Association name=""> 
    <Role class="Order" multiplicity="*" name="" 
      type="start"/> 
    <Role class="Customer" multiplicity="1" name="" 
      type="end"/> 
  </Association> 

</Content>