---
updatedAt: 2025-06-16T23:15:25.000Z
agentTools:
  projectIndex: https://developers.directscale.com/llms.txt
---

# Using XML

<Embed url="https://www.youtube.com/embed/L5rIkJCY-0A?start=13" title="Elements of a XML Compensation Plan" favicon="https://www.youtube.com/favicon.ico" image="https://i.ytimg.com/vi/L5rIkJCY-0A/hqdefault.jpg" provider="youtube.com" href="https://www.youtube.com/embed/L5rIkJCY-0A?start=13" html="%3Ciframe%20class%3D%22embedly-embed%22%20src%3D%22%2F%2Fcdn.embedly.com%2Fwidgets%2Fmedia.html%3Fsrc%3Dhttps%253A%252F%252Fwww.youtube.com%252Fembed%252FL5rIkJCY-0A%253Ffeature%253Doembed%2526start%253D13%26display_name%3DYouTube%26url%3Dhttps%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253DL5rIkJCY-0A%26image%3Dhttps%253A%252F%252Fi.ytimg.com%252Fvi%252FL5rIkJCY-0A%252Fhqdefault.jpg%26key%3Df2aa6fc3595946d0afc3d76cbbd25dc3%26type%3Dtext%252Fhtml%26schema%3Dyoutube%22%20width%3D%22854%22%20height%3D%22480%22%20scrolling%3D%22no%22%20title%3D%22YouTube%20embed%22%20frameborder%3D%220%22%20allow%3D%22autoplay%3B%20fullscreen%22%20allowfullscreen%3D%22true%22%3E%3C%2Fiframe%3E" />

The [XML Editor](https://developers.directscale.com/docs/xml-compensation-plan-editor) uses XML to describe compensation plans. Every template will begin with the line:

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

This defines the XML version and the character encoding (8-bit Unicode Transformation Format (UTF-8)).

Next, we have to define the template. Contain templates within the opening and closing `<Template>` tag.

```xml
<Template> 

</Template>
```

Every element in an XML document must have a beginning and ending tag or begin and end within one tag:

```xml
<SetRank Rank="5" />
```

The `<SetRank>` tag above is self-closing because it ends with `/`; meaning, it doesn’t need a separate `</SetRank>` closing tag.

This `<SetRank>` element also has an attribute named `Rank`. Use attributes to set simple values for an element. For more complex values, nest elements inside each other.

For example, the `<Template>` below has `<Rules>` within it. One of the rules is `Name="G2" Description="Gold 2"`, which has conditions required to meet. If met, you will become a Rank 5 Associate.

```xml
<Template>
  <Rule Name="G2" Description="Gold 2">
    <And>
      <MeetsRule Rule="Active" />
      <MeetsRule Rule="G1" />
      <PVCondition Max="-1" Min="150" Volume="pqv" />
    </And>
    <Result>
      <SetRank Rank="5" />
    </Result>
  </Rule>
</Template>
```

In this example, the Associate needs to meet the conditions (`<MeetsRule>`) for `"Active"` and `"G1"`, as well as have at least 150 (`Min="150"`) Personal Volume from `Volume="pqv"`. You must define these terms elsewhere in the `<Template>`.

As you build your commission template, you define:

* Different types of volume
* Where they come from
* How to earn them.

You then use these volumes later on in:

* Calculating payouts
* Determining which Rank the Associate has earned

## `<AND>`

Logical AND. All statements in the `AND` are looked at as a group. If you have a `<Rule>` with three statements in the `<AND>`, every statement must be true for the Rule condition to be true. If one statement is false, then the Rule is not met.

**Example**

```xml
 <Rule Description="PS Commission Active" Name="PSComACT">
    <And>
      <PVCondition Max="-1" Min="200" Volume="PS" />
      <MeetsRule Rule="Aff" />
    </And>
</Rule>
```

Put simply:

`<Do This>`

`<Do This>`

AND

`<Do This>`

***

## `<OR>`

Logical OR. Each `<OR>` is looked at individually. If you have a `<Rule>` with three statements in the `<OR>`, only one of the statements must be true for the Rule condition to be true.

**Example**

```xml
<Rule Name="Member" Description="Member">
  <Or>
    <AssociateTypeCondition AssociateBaseType="4" />
    <AssociateTypeCondition AssociateBaseType="5" />
    <AssociateTypeCondition AssociateBaseType="6" />
  </Or>
</Rule>
```

Essentially, you could look at it like this:

`<Do This>`

OR

`<Do This>`

OR

`<Do This>`

***

## `<ANDNOT>`

Logical NOT. You can mark an exception for a particular condition. You can meet the `<Rule>` as long as your condition is not X.

**Example**

```xml
<Rule Name="FSNotPay" Description="Fast Start Not Paid">
  <AndNot>
    <PaidOnCondition Bonus="Fast Start 1" Rule="FSNotPay" IncludePastPeriods="True" IncludeCurrentPeriod="True" />
  </AndNot>
</Rule>
```

It's like saying, "It's anything BUT this."