====== < grammar > ======
===== Description =====
The < grammar > element specifies a grammar (word or phrase) for speech recognition. When the grammar is recognized, the application may perform an action (such as a transition to another field item), or assign values to a field item variable. Multiple values can also be assigned with mixed initiative forms.
NOTE:
Inline grammars that use the XML grammar format will be passed into the Speech Recognition Engine as an XML document. The interpreter first decodes the VoiceXML document and then re-encodes the inline grammar into an XML document to pass to the Engine.
===== Syntax =====
xml:lang="language"
src="URI"
scope="dialog" | "document"
type="MIME_Type"
mode="dtmf" | "voice"
root="String"
version="version_number"
weight="positive floating_point"
fetchhint="prefetch" | "safe"
fetchtimeout="time_interval"
maxage="time_interval"
maxstale="time_interval">
inline grammar
===== Attributes =====
|xml:lang|The xml:lang attribute is the language and locale identifier of the grammar. Please refer to the multi-language support tutorial for detailed information. This attribute is optional and defaults to en-US. The value choices are en-US, en-UK, fr-FR...|
|src|The src attribute is the URI of the grammar specification. The URI can have one of the following formats: \\ * External grammar file – the URI of the grammar file. \\ * Built-in grammars – the builtin:grammar/type or builtin:dtmf/type, refer to element for built-in types.|
|scope|The scope attribute defines the scope of the grammar. This attribute can be defined only if this < grammar > element is the child of a < form > or < menu > element. This attribute is optional and defaults to dialog. \\ * dialog – the grammar is only active within the form. \\ * document – the grammar is active throughout the document. If this is an application root document and the grammar is active throughout the application.|
|type|The type attribute defines the MIME type of grammar format. \\ The following types are supported: \\ * application/x-jsgf for internal speech recognition. \\ * text/x-grammar-choice for voice speech recognition. \\ * text/x-grammar-choice-dtmf for DTMF recognition. \\ * application/srgs+xml for SRGS/XML grammar format. \\ * application/lumenvox-abnf for Lumenvox/ABNF format. \\ * application/isolated for Verbio/Isolated grammar format. \\ * application/verbio-abnf for Verbio/ABNF grammar format.|
|mode|The mode attribute defines the mode of the grammar. This attribute is required.\\ * voice – the voice input. \\* dtmf – the DTMF input. This replaces the obsolete element in VoiceXML 1.0.|
|root|The root attribute specifies the root rule of the grammar when this is an inline XML grammar. This attribute is optional and defaults to default rule.|
|version|The version attribute defines the version of the grammar. This attribute is optional and defaults to 1.0.|
|weight|The weight attribute defines the weight of a grammar, which indicates the possible occurrence of the grammar which can potentially increase recognition accuracy. Grammar weights only affect grammar processing; they do not affect the processing of grammar results. Different speech recognition engines and VoiceXML platforms also treat weights differently. This attribute does not apply to DTMF grammars and implicit grammars (i.e. elements as children of