VoiceXML2.0规范 第二章 Dialog的结构

VoiceXML2.0规范
 
第二章  Dialog的结构 [第一章 ][前一章 ][后一章 ]
 
第四节 Filled 第一节   第二节   第三节   第五节
 
    <filled>元素指定了当一个或多个input item被填充后要执行的操作。它可以出现在两个地方:作为<form>元素的子元素,或者作为input item的子元素。
    如果作为<form>元素的子元素,当一个或多个input item的组合被填充后,<filled>元素用于执行一些操作。下面的例子中的<filled>元素用于交叉检查以确保“start_city” <field>和“end_city”<field>的识别结果不一样:
      <?xml version="1.0" encoding="UTF-8"?>
      <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.w3.org/2001/vxml
               http://www.w3.org/TR/voicexml20/vxml.xsd">
        <form id="get_starting_and_ending_cities">
          <field name="start_city">
            <grammar src="http://www.grammars.example.com/voicexml/city.grxml"
                   type="application/srgs+xml"/>
            <prompt>What is the starting city?</prompt>
          </field>
          <field name="end_city">
            <grammar src="http://www.grammars.example.com/voicexml/city.grxml"
                   type="application/srgs+xml"/>
            <prompt>What is the ending city?</prompt>
          </field>
          <filled mode="all" namelist="start_city end_city">
            <if cond="start_city == end_city">
               <prompt>You can't fly from and to the same city.</prompt>
               <clear/>
            </if>
          </filled>
        </form>
      </vxml>
    如果<filled>作为一个input item的子元素出现,它指定了当该input item被填充后要执行的操作:
      <?xml version="1.0" encoding="UTF-8"?>
      <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.w3.org/2001/vxml
               http://www.w3.org/TR/voicexml20/vxml.xsd">
        <form id="get_city">
          <field name="city">
            <grammar type="application/srgs+xml" 
                 src="http://www.ship-it.example.com/grammars/served_cities.grxml"/>
            <prompt>What is the city?</prompt>
            <filled>
              <if cond="city == 'Novosibirsk'">
                <prompt>Note, Novosibirsk service ends next year.</prompt>
             </if>
            </filled>
          </field>
        </form>
      </vxml>
    每次收集用户的输入后,该输入中提及的input item都被做了标记,然后解释器根据每个<filled>元素在文档中的顺序(input item中的<filled>元素和<form>中的<filled>元素优先权一样)依次访问它们。那些匹配该utterance的<filled>元素被依次执行,除非已经没有<filled>元素,或者出现控制跳转,或者抛出事件。
    <filled>元素的属性有:
mode值为all(默认)或any。如果值为any,当任意一个指定的input item被用户最近一次的输入填充后,就执行该<filled>元素的操作。如果值为all,当所有提到的input item被填充,且用户最后一次输入填充了至少一个input item,就执行该<filled>元素的操作。在input item中的<filled>元素不能指定该属性。
namelist要触发的input item。对于<form>元素中的<filled>元素,该属性默认为该form中所有的input item变量(包括显式和隐式)。一个input item中的<filled>元素则不能指定该属性,这种情况下,namelist属性值实际上就是该input item的名称。注意control item不能出现在该属性中。
表25:<filled>元素的属性
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值