A Sample VoiceXML Document
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0">
<form id="get_address">
<field name="citystate">
<grammar type="application/srgs+xml" src="citystate.grxml"/>
<prompt>Say a city and state.</prompt>
</field>
<field name="street">
<grammar type="application/srgs+xml" src="citystate.grxml"/>
<prompt> What street are you looking for? </prompt>
</field>
<filled>
<prompt>
You chose
<value expr="street"/>
in
<value expr="citystate"/>
</prompt>
<exit/>
</filled>
</form>
</vxml>
-
The first two lines (the <?xml> and the <vxml> elements) are required for the beginning of all VoiceXML 2.0 files.
-
The <form> element, similar to an HTML form, controls the interaction or “dialog” with the user.
-
Form <field> elements specify the contents of a VoiceXML dialog unit. Fields contain other elements, such as:
-
<prompt> elements that control the output of synthesized speech and prerecorded audio and prompt a user for input.
-
<grammar> elements that specify what user input is acceptable for a field. In this case, the grammar element references the file that specifies the grammar, the rules by which to recognize input. The user input is stored in the variable that is named by the field.
-
<filled> elements that specify actions to take when a field is filled in; that is, when the user has provided a valid value for the field.
-