3.5. catch

Element typecatch
Attributesevent | cond | count
Parentsfield | form | initial | menu | object | record | subdialog | transfer | vxml
Childrenassign | audio | clear | disconnect | enumerate | exit | goto | if | log | prompt | reprompt | return | script | submit | throw | value | var
DescriptionCatches the events listed in the event attribute. The count and cond attributes optionally control if a catch is visited. Anonymous variables:

_event (2.0)

Is the event that was thrown.

_message

Is the corresponding message string of the throw element (see 3.54, “throw,”).


DTD

<!ELEMENT catch (%executable.content;)* >
<!ATTLIST catch
  event %event.names; #REQUIRED    
  %event.handler.attrs; >

Language model



Attributes

accept : (exact | approximate)

New to VoiceXML 2.0, this attribute can be set to exact (by default) or approximate. It specifies how the grammar recognition should handle each choice element. Individual choice elements can override this setting.

cond : expression = true

This event handler will only be executed if this ECMAScript expression evaluates to true.

count : integer

The event handler should be run only when the counter associated with a menu, form, or form item is equal to the quantity specified by this attribute. In the case where there is no count value equal to the counter, then the catch with the lowest count value, which is greater than the counter, will be selected. When the counter is greater than all count values, the catch with the highest count value will be selected.

event : event.names

One or more events that this catch block handles.

Children

executable.content

The code to be executed when this catch block handles an asynchronous event (e.g. the caller hanging up the phone, uttering a word recognized by an active grammar, etc.).

Examples

Example 3-7. Catching the same event with changing responses
<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0"> 
  <form id="flavor">
    <field name="selection">
      <grammar> flavors </grammar> 
      <prompt> 
        Please say one of the following flavors: chocolate, vanilla, 
        or strawberry. 
      </prompt>

      <catch event="nomatch noinput" count="1"> 
        Select from chocolate, vanilla, or strawberry. 
      </catch>
      <catch event="nomatch noinput" count="2">
        You must say either chocolate, vanilla, or strawberry. 
      </catch>
    </field>
    <filled>
      Your selection is being prepared.
    </filled>
  </form>
</vxml>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.36.213