<?xml version="1.0"?>
<!-- @ Copyright 1998-2003 W3C (MIT, ERCIM, Keio), All Rights Reserved. See http://www.w3.org/Consortium/Legal/. @ -->
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
      xmlns:conf="http://www.w3.org/2002/vxml-conformance">

<!--
    If an event is thrown during the execution of a <filled>,
    event handler selection starts in the scope of the <filled>,
    which could be a form item or the form itself, and then
    proceeds outward by enclosing dialog scopes.
-->

  <catch event="foo">
    <conf:fail reason="The document handler should not be used."/>
  </catch>

  <catch event="bar">
    <conf:pass/>
  </catch>

  <catch>
    <conf:comment>
      Toplevel caught event <value expr="_event"/>
    </conf:comment>
    <conf:fail expr="_event"/>
  </catch>


  <!-- This form tests the form item scoped handler. -->
  <form id="form1">
    <catch event="foo">
      <conf:fail reason="The form handler should not be used."/>
    </catch>
    <field name="a">
      <conf:speech value="alpha"/>
      <conf:grammar utterance="alpha"/>
      <catch event="foo">
        <goto next="#form2"/>
      </catch>
      <filled>
      <throw event="foo"/>
    </filled>
    </field>
    <block>
      <conf:fail reason="Should not get here."/>
    </block>
  </form>


  <!-- This form tests the form scoped handler. -->
  <form id="form2">
    <catch event="foo">
      <goto next="#form3"/>
    </catch>
    <field name="a">
      <conf:speech value="bravo"/>
      <conf:grammar utterance="bravo"/>
      <filled>
      <throw event="foo"/>
    </filled>
    </field>
    <block>
      <conf:fail reason="Should not get here."/>
    </block>
  </form>


  <!-- This form tests the document scoped handler. -->
  <form id="form3">
    <field name="a">
      <conf:speech value="charlie"/>
      <conf:grammar utterance="charlie"/>
      <filled>
      <throw event="bar"/>
    </filled>
    </field>
    <block>
      <conf:fail reason="Should not get here."/>
    </block>
  </form>

</vxml>
