VoiceXML 2.1 Development Guide Home  |  Frameset Home

  GSL Basics  |  TOC  |  Universal Grammars  

GSL Grammar Hints

Note: GSL syntax is not considered to be a W3C-compliant syntax for grammars, and the Nuance has discontinued support for GSL grammars in their most recent product offerings. Voxeo will continue to support GSL-specific markup for some time to come, but it is strongly suggested that new applications and their associated grammars leverage the SRGS + SISR grammar syntaxes instead of being reliant upon the deprecated GSL grammar format.

If we are designing an application with a small number of available caller options, then chances are that you'll either want to use an inline structure, or use the menu and option elements to keep the code nice and compact. However, if you have more complicated grammar/subgrammar structures that contain a lot of options, then you might well want to go with an external grammar reference in order to reduce clutter in your XML documents.

Grammar Fetching

Let's first take on some core GSL grammar facts that will get us started on the right foot. To start with, if we are using a fairly large external grammar file, we don't want our callers to experience any delays while the grammar is being fetched and compiled. For this reason, we recommend that you use the following property setting within the root document of your code:


  <property name="grammarfetchint" value="prefetch"/>


Note that this setting is enabled by default, however it is always better to have this value user-defined in your code to retain maximum flexibility and platform compliance.

Grammar Caching

External grammar files follow the same caching rules as XML documents do. Either we set cache control headers on the server side, or we set it on a per-case basis within each file itself. Note that Voxeo's cache proxies will cache all grammars by default. While in development, we'll most likely want to disable caching:


  <grammar src="MyGrammar.cfm#MYRULE" type="text/gsl"/>


Note that the above grammar references a grammar of type '.cfm', (Cold Fusion), which will likely contain CF-specific caching headers, and possibly some dynamic data:

==MyGrammar.cfm==

<cfheader name="Cache-Control" value= "no-cache">
<cfheader name="Expires" value="#Now()#">


MAINMENU [
  [ tricky] {<FieldName "Run DMC">}
  ]



In looking over this file, it is evident that we do, in fact have some caching headers set, 'Cache-Control', and 'Expires'. These two lines ensure that any changes we make to the grammar are reflected immediately when calling the application, as the grammar file will not be using a cached copy.



  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  GSL Basics  |  TOC  |  Universal Grammars  

© 2013 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site