CallXML 3.0 Development Guide Home  |  Frameset Home


<clear>  element


Clears variable specified by the attribute var. As show below, will clear a variable named "MyVar". Effectively this works the same as <assign var="MyVar" value="" />


usage

<clear id="(element id)" test="CDATA" value-is="STRING" value-is-not="STRING" var="(variable name)">


attributes

id Data Type: (element id) Default: none - attribute is optional
The new 'id' attribute in CallXML3.0 is applicable to all container and action elements. Specifying this attribute allows yet another level of control and event handling when events occur and are caught by the <on> element. When an event occurs, the handler will first check the event, and then verify that the handler has a handler specific to the 'id' attribute to execute. This allows the developer to plan a specific course of action for events based on where in the application that they occur.
test Data Type: CDATA Default: Optional
The 'test' attribute is a new supplement to the CallXML markup that permits the developer to execute the contents of a container element, or action element, based on whether or not the specified condition is met. If the defined condition is met, then the code contained within the element is then executed. If the condition is not met, then the application resumes execution with the next sequential container container element in the document.
value-is Data Type: STRING Default: none - attribute is optional
Another new attribute, 'value-is', grants the developer with the ability to perform conditional logic upon container elements, or action elements for the first time within the CallXML markup. The value specified in the 'value-is' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is' equate to 'true', then the element specified will execute. If the value equates to 'false' then the element will be skipped during document execution.
value-is-not Data Type: STRING Default: none - attribute is optional
Another new attribute, 'value-is-not', grants the developer with the ability to perform conditional logic upon container elements, or action elements, for the first time within the CallXML markup. The value specified in the 'value-is-not' attribute specifies a string to compare against any 'value' attributes. If the 'value' and 'value-is-not' equate to 'false', then the element specified will execute. If the value equates to 'true' then the element will be skipped during document execution.
var Data Type: (variable name) Default: none - attribute is required
The var attribute defines the name of the variable to set to an undefined state.



code samples

<3.0 clear var>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <assign var="MyVar" value="Buttafuocco"/>
    <say>
      Our starting variable value is $MyVar;
    </say>

    <clear var="MyVar"/>
  </block>

  <block label="B2">
    <say>
      But now, since we have cleared it, the value is $MyVar;   
    </say>
  </do>
</callxml>



<3.0 clear-valueis>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">

  <do label="B1" value="foo">
    <assign var="MyVar" value="Buttafuocco"/>
    <say>
      Our starting variable value is $MyVar;
    </say>
  <!-- this will not execute, as the block value is NOT equal to bar -->
    <clear var="MyVar" value-is="bar"/>

  <!-- this will execute, as the block value IS equal to bar -->
    <clear var="MyVar" value-is="foo"/>
  </do>



  <do label="B2">
    <say>
      But now, since we have cleared it, the value is $MyVar;   
    </say>

  <assign var="MyVar" value="Hasselhoff"/>
  </do>



  <do label="B3" value="foo">
    <say>
      We have now re assigned our variable to be $MyVar;   
    </say>

  <!-- this will execute, as the block value is NOT equal to bar -->
    <clear var="MyVar" value-is-not="bar"/>

  <!-- this will not execute, as the block value IS equal to bar -->
    <clear var="MyVar" value-is-not="foo"/>


  </do>

  <do label="B4">
    <say>
      But now, since we have cleared it, the value is $MyVar;   
    </say>

  </do>


</callxml>



<3.0 clear-test>
<?xml version="1.0" encoding="UTF-8"?>

<callxml version="3.0">
  <do label="B1">
    <assign var="MyVar" value="Buttafuocco"/>
    <say>
      Our starting variable value is $MyVar;
    </say>

<!-- this will execute, as Joey IS NOT equal to Carmine -->
    <clear var="MyVar" test="'Joey' = 'Carmine'"/>
    <log>*** MYVAR: $MyVar;  ***</log>

<!-- this will execute, as Joey IS equal to Joey -->
    <clear var="MyVar" test="'Joey' = 'Joey'"/>
    <log>*** MYVAR: $MyVar;  ***</log>
  </block>

  <block label="B2">
    <say>
      But now, since we have cleared it, the value is $MyVar;   
    </say>
  </do>
</callxml>




additional links

none


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2012 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site