- Voice XML Grammar Options
- XML Grammars
- Inline versus External Grammars
- Going External
- Summary
- Resources
Inline versus External Grammars
In the examples presented here we used inline grammars. Voice XML also supports external grammars, stored in a file on a server. When starting out, it’s easier to work with inline grammars; as your application gets more complex and/or you want to reuse your grammars in other applications, you can move it to an external location and reference it from within your voice application.
Some points of distinction between internal and external grammars:
- Internal: An inline grammar is defined within the
<grammar> element in a Voice XML document.
In an inline grammar, if the grammar consists of exactly one rule, that rule does not have to have a name.
GSL grammars use special characters—wrap your inline grammar as a section of CDATA.
- External: An external grammar is defined in an external
file and referenced in the Voice XML document.
In an external grammar document, all rules must be named.
In an external GSL grammar file, the contents of that file should not be inside a CDATA section and should not contain a <grammar> element.