CCXML document structure

CCXML documents are a type of XML document, so they all begin with an XML document header, followed by a <ccxml> element, an initial part (containing variable declarations and document control information), and an event processing part including one or more <transition> elements.

CCXML documents are a type of XML document, so they all begin with an XML document header, followed by a <ccxml> element:
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0"> 
A CCXML document contains a single <eventprocessor> element that divides the document into two distinct parts. The ‘initial’ part of the document is all the elements between the start of the <ccxml> element and the start of the <eventprocessor> element. The ‘event processor’ part of the document is all of the elements contained within the <eventprocessor> element:
<ccxml ..... >
   ^
   |
   |
   |      Initial Part
   |
   |
   v
  <eventprocessor>
        ^
        |
        |  Event Processor Part
        |
        |
        v
   </eventprocessor>
</ccxml>  

The initial part

This part is executed only once and normally contains the declaration of global variables using the <var> element or ECMA script declarations using the <script> element or document control information using the <meta> element.

The event processor part

The ‘event processor’ part is made up of <transition> elements. Each <transition> element specifies a combination of conditions that must evaluate to “true” for the elements within the <transition> to be executed.
<eventprocessor>
  <transition event="ccxml.loaded" ...>
       .
       .
  </transition>
  <transition event="connection.alerting" cond="varx > 100" ...>
       .
       .
  </transition>
  <transition event="connection.alerting" cond="varx > 200" ...>
       .
       .
  </transition>
  <transition event="connection.connected"...>
       .
       .
  </transition>
  <transition event="error.*"...>
       .
       .
  </transition>
<eventprocessor>  

Each time an event is received by the document the event processor evaluates the <transition> conditions in document order — starting with the first <transition> in the <eventprocessor> then the second in a ‘top-down’ manner. If the conditions of a <transition> evaluate to “true” then the elements within the <transition> are executed. No further <transition> elements are evaluated, the event processor waits for the next event before starting the top down evaluation .