Search code examples
grammarvxml

Voicexml grammar


I try to use grammar in my voicexml file. At first i tried an In-line grammar. I used an example from a website, but it doesn't work.

here is the code:

<?xml version="1.0" encoding="UTF-8"?> 
<vxml [...]  version="2.0">


<form id="test">

<field name="var">
<prompt>choose</prompt>

<!-- ABNF -->
<grammar> one | two | three| four </grammar>

<filled>
you chose <value expr="var"/> 
</filled>

</field>


</form>
</vxml>

thanks


Solution

  • Your VXML grammar format may not be compatible with your platform. Try this instead:

    <grammar root="main" version="1.0" xml:lang="en">
    
      <rule id="main" scope="public">
        <one-of>
          <item>one</item>
          <item>two</item>
          <item>three</item>
          <item>four</item>
        </one-of>
      </rule>
    
    </grammar>
    

    instead of...

    <grammar> one | two | three| four </grammar>