|
VoiceXML:
Where Speech Meets the Web
(Continued
from Part 1)
For
a better example of how elements and containers nest,
let's have a look at our third example from last month:
Example 3: Advanced Hello World (excerpt) <?xml version="1.0"?> <vxml version="1.0"> <!--Example 3 for VoiceXML Review --> <form> <block> <prompt> <audio src="http://www.voicexml.org/audio/helloworld.wav"> Hello, World! </audio> <prompt> </block>
<field name="greeting">
<prompt> What say you? </prompt>
<grammar> hello | howdy | greetings | hey | password </grammar>
<help> You can say hello, howdy, greetings, hey, or password </help>
<filled> You said <value expr="greeting"/> </filled>
</field>
<block> <!--Decide whether to continue talking to this caller --> <submit next="http://www.voicexml.org/ cgi-bin/friend_or_foe.cgi"/> </block>
</form> </vxml>
|
And
here is the stylized version:
Here
we see the structure of a sample <field> element,
used to collect input from the user. This field element
has a number of children:
- prompt
- The announcement to be presented to the use to convince
them to say something.
- grammar
- a definition of what is considered legal speech
input to this field item. In this case, a set of alternative
greetings is acceptable.
- filled
- a description of the actions to undertake when the
field is considered 'filled'. A field is declared
filled (in this case) when the use has said something
matching the grammar: 'hello', 'howdy', or one of
the other grammar alternatives.
- Help
Event - A description of the actions to undertake
when the user requests help. In this example, merely
some text indicating what is acceptable (this is read
to the user).
It's
important to understand this structure, particularly
when starting out, as it will enable you to avoid headaches
caused by improperly formed documents. It's a good idea
to find and use an XML editor and/or validator that
can take advantage of the VoiceXML DTD to ensure your
pages are 'well-formed'.
What's
Next?
Next month, we're going to talk about the features in
VoiceXML for building bigger applications, and how you
can structure such an application. In the meantime,
you might want to have a look at these resources provided
by the VoiceXML Forum:
A
number of VoiceXML Forum Members provide access to developer
sites and tool kits that will allow you to try out VoiceXML
for yourself. A few of these are:
back
to the top
Copyright
© 2001 VoiceXML Forum. All rights reserved.
The VoiceXML Forum is a program of the
IEEE
Industry Standards and Technology Organization (IEEE-ISTO).
|