A basic VoiceXML application

Basic rules

Because VoiceXML is an extension of XML, you will have to follow the basic rules for XML, which include: * Well-formed XML documents: All elements must have a closing tag. * A root element: All documents must have a root element. The root element for a VoiceXML document is vxml. * Attributes: Attribute values must always be quoted. * Nesting: All elements must be properly nested.

<xml> version tag

It is recommended that the first line item in any VoiceXML document be the XML version tag:

<?xml version="1.0"?>

<vxml> root tag

The rest of the VoiceXML document should be enclosed within the vxml tag:

<vxml version = "2.1" xmlns="http://www.w3.org/2001/vxml">

Basic VoiceXML structure

Following is an outline of a basic VoiceXML application structure:

<?xml version="1.0"?>
<vxml version = "2.1" xmlns="http://www.w3.org/2001/vxml">
...
</vxml>

An example: Hello world!

In this example, you will create a simple Hello world! VoiceXML application. Copy and paste the following code into the VoiceXML tool of your choice (such as Tellme Studio) and dial the number to test the application. (The number to dial for Tellme Studio in the U.S. is 1-800-555-VXML. You will need a developer ID to access this number.) The form and block elements are discussed in the next section.

<?xml version="1.0"?>
<vxml version = "2.1" xmlns="http://www.w3.org/2001/vxml">
 <form>
  <block>Hello world!</block>
 </form>
</vxml>