| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<initial> element, so we will explore this and excercise our newfound knowledge
<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.1">
<meta name="maintainer" content="youremail@here.com"/>
<form id="DeadCelebrities">
<grammar src="Celeb.grammar#CELEBRITY" type="text/gsl"/>
<initial name="myInit">
<prompt>
Welcome to the dead celebrity hotline.
Please tell us which dead celebrity you saw, and where we can find him.
</prompt>
</initial>
<field name="celebrity">
<prompt>
Which celebrity did you see?
</prompt>
</field>
<field name="location">
<prompt>
And where was he sighted at?
</prompt>
</field>
<filled mode="all">
</filled>
</form>
</vxml>
<filled> statement at the <field> level. Remember, because our form scoped grammar is really doing all the work, it is appropriate that we also scope the <filled> element to the form level as well. Also, we specified the <meta> tag in our code at the very top, which all celebrity developers do, be they dead or alive. As you all know, specifying this element in your XML document will allow a debug email to be sent to you in the event of an application error, which will inform you of what went wrong, and how to fix it. This automated process even works from beyond the grave.
CELEBRITY
[
(?FILLER CELEB:a ?FILLER LOCATION:b)
{<celebrity $a.celebrity> <location $b.location> }
(?FILLER CELEB:a )
{<celebrity $a.celebrity> }
(?FILLER LOCATION:b)
{ <location $b.location> }
]
CELEB
[
[(elvis ?the ?pelvis ?presley) (the king)]
{<celebrity "Elvis Presley">}
(buddy holly)
{<celebrity "Buddy Holly">}
[(john travolta) (vinnie barbarino) (vinnie vega)]
{<celebrity "John Travolta">}
[(frank sinatra) (old blue eyes)]
{<celebrity "Frank Sinatra">}
[(marty feldman) (old cross eyed)]
{<celebrity "Marty Feldman">}
[(jim morrison) (?the lizard king)]
{<celebrity "Jim Morrison">}
]
LOCATION
[
(flea market )
{<location "Flea Market">}
(wrestling match )
{<location "Rasslin Match">}
(las vegas )
{<location "Vegas">}
(my bathroom )
{<location "My Bathroom">}
(grace land )
{<location "Graceland">}
(dairy queen )
{<location "Dairy Queen">}
(france)
{<location "France">}
]
FILLER
[
; filler grammar to prefix 'celeb' utterance
(i saw)
(could swear it was)
(it was)
(holy moley)
; filler grammar to prefix the 'location' utterance
(in ?the)
(ditty bopping along ?near ?at)
(big as life ?near ?at)
( looking ?shorter ?uglier ?insane in person ?at)
(hanging out ?at ?near)
(eating like a pig ?at ?in ?near ?(behind back))
]
<reprompt> element into the mix, as well. Let us take a peek at this, along with a few other curve balls that have been added into our existing code:
<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.1">
<meta name="maintainer" content="youremail@here.com"/>
<form id="DeadCelebrities">
<grammar src="Celeb.grammar#CELEBRITY" type="text/gsl"/>
<initial name="myInit">
<prompt>
Welcome to the dead celebrity hotline.
Please tell us which dead celebrity you saw, and where we can find him.
</prompt>
<nomatch count="1">
<prompt>
Okay, I'll ask you for information one piece at a time.
</prompt>
<assign name="myInit" expr="true"/>
<reprompt/>
</nomatch>
</initial>
<field name="celebrity">
<prompt>Which celebrity did you see?</prompt>
<grammar src="Celeb.grammar#CELEB" type="text/gsl"/>
</field>
<field name="location">
<prompt>And where was he sighted at?</prompt>
<grammar src="Celeb.grammar#LOCATION" type="text/gsl"/>
</field>
<filled mode="all">
</filled>
</form>
</vxml>
<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.1">
<meta name="maintainer" content="youremail@here.com"/>
<form id="DeadCelebrities">
<grammar src="Celeb.grammar#CELEBRITY" type="text/gsl"/>
<initial name="myInit">
<prompt>
Welcome to the dead celebrity hotline.
Please tell us which dead celebrity you saw, and where we can find him.
</prompt>
<nomatch count="1">
Okay, I'll ask you for information one piece at a time.
<assign name="myInit" expr="true"/>
<reprompt/>
</nomatch>
</initial>
<field name="celebrity">
<prompt>Which celebrity did you see?</prompt>
<grammar src="Celeb.grammar#CELEB" type="text/gsl"/>
</field>
<field name="location">
<prompt>And where was he sighted at?</prompt>
<grammar src="Celeb.grammar#LOCATION" type="text/gsl"/>
</field>
<filled mode="all">
<if cond="celebrity == 'John Travolta'">
<prompt>
True, John Travolta is still alive, but his career sure isnt.
</prompt>
</if>
<prompt>
Thank you for your report.
A team armed with butterfly nets and
</prompt>
<if cond="celebrity=='Elvis Presley'">
<prompt>
a peanut butter and banana sandwitch
</prompt>
<elseif cond="celebrity =='Buddy Holly'"/>
<prompt>
a pair of contact lenses
</prompt>
<elseif cond="celebrity =='John Travolta'"/>
<prompt>
a script for battlefield earth part two
</prompt>
<elseif cond="celebrity =='Frank Sinatra'"/>
<prompt>
a double martini, and two teenage girls
</prompt>
<elseif cond="celebrity =='Marty Feldman'"/>
<prompt>
an all you can eat shrimp platter
</prompt>
<elseif cond="celebrity =='Jim Morrison'"/>
<prompt>
L S D
</prompt>
</if>
<prompt>
for bait will be deployed by helicopter to
<value expr="location"/>
in an attempt to recapture
<value expr="celebrity"/>
</prompt>
</filled>
</form>
</vxml>
<initial> element| ANNOTATIONS: EXISTING POSTS |
zweit
|
|
| Hi,
After I have changed the value of "count" to "2" in <nomatch> tag and seen the effect, I understood what role "count" played, or have you mentioned it in the former lessons? regard ------- Secondt |
|
Michael.Book
|
|
| Howdy Secondt,
The tutorials, in the interest of brevity, simply do not detail every element and attribute used in the sample code. However, this VoiceXML documentation set does include handy breakdowns of each VoiceXML element and its respective attributes. Just find the element that has sparked your curiosity under the "ELEMENTS" menu at the bottom of the frame on the left, and give it a click. Detailed goodness awaits... I hope this helps... Have Fun, ~ Michael |
| login |
|