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.
<?xml version="1.0" encoding="UTF-8"?> <ccxml version="1.0">
<ccxml ..... >
^
|
|
| Initial Part
|
|
v
<eventprocessor>
^
|
| Event Processor Part
|
|
v
</eventprocessor>
</ccxml>
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.
<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 .