1

我已经编写了一个 VXML,它在大多数情况下都有效。我现在想使用 grxml 而不是内联语法。

我在与我的 vxml APP 相同的目录中创建了 icecream.grxml,我这样称呼它

<grammar src="icecream.grxml" type="application/srgs+xml"/>

例如

<form id="formIdicecream">
<grammar src="icecream.grxml" type="application/srgs+xml"/>
<field name="icecream">  <prompt> What is your favorite icecream? </prompt> </field> 
<field name="confirm"> 
    <prompt> Your favorite icecream is <value expr="icecream$.utterance"/> </prompt> 
</field>
<block> <goto next="#formIddtmf"/> </block>

我的 icecream.grxml 如下所示,当我运行代码时出现错误:

语法激活失败|MSG=错误激活语法|URI=icecream.grxml

#
<!--Header-->
<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar"
xml:lang="en-US"
root="icecream"
mode="voice">

<!--Rules-->
<rule id="icecream">
<one-of>
<item><ruleref 
 uri="#vanilla" /></item>
<item><ruleref 
 uri="#chocolate" /></item>
 <item><ruleref 
 uri="#strawberry" /></item>
</one-of>
</rule>
<rule id="vanilla">
<one-of>
<item>vanilla</item>
<item>nilla</item>
</one-of>
</rule>
<rule id="chocolate">
<one-of>
<item>chocolate</item>
<item>colate</item>
</one-of>
</rule>
<rule id="strawberry">
<one-of>
<item>strawberry</item>
<item>straw</item>
</one-of>
</rule>
</grammar>
4

0 回答 0