Grammar Headers
This topic includes the following sections:
- Required, recommended, and optional headers
- Stand-alone grammar header example
- Simplified header for stand-alone grammars
- Inline grammar header example
Required, recommended, and optional headers
Header/Attribute | Definition | Stand-Alone Grammars | Inline Grammars |
---|---|---|---|
XML header |
|
Required |
Not applicable |
XML DOCTYPE |
DTD |
Recommended |
Not applicable |
|
xml schema |
Recommended |
Not applicable |
|
XML namespace |
Required |
Do not use |
|
Grammar version |
Must be: |
Must be: |
|
Character encoding |
Recommended |
Not applicable |
|
Grammar mode (voice or DTMF) |
Required for |
Required for |
|
Language |
Required if |
Required if |
|
Root rule |
Optional for external grammars whose rules are always referenced with a fragment reference ( |
Required by the Tellme Platform. |
|
MIME type |
|
|
|
Semantic Interpretation Tag Syntax |
Required if |
Required if |
|
Base URI for locating relative URIs in different rules. |
Optional |
Optional |
|
Pronunciation lexicon used when the lang declaration is present. |
Not yet supported by the Tellme Platform. |
Not yet supported by the Tellme Platform. |
|
Metadata tag. Allows user to specify an http-equiv property. Differs from the XML metadata declaration. |
Optional; multiple allowed. |
Not applicable |
|
XML metadata tag for placing document information in a metadata scheme. |
Optional |
Not applicable |
Stand-alone grammar header example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
"http://www.w3.org/TR/speech-grammar/grammar.dtd">
<grammar xmlns="http://www.w3.org/2001/06/grammar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar
http://www.w3.org/TR/speech-grammar/grammar.xsd"
version="1.0"
mode="voice"
xml:lang="en"
type="application/srgs+xml"
tag-format="semantics/1.0"
root="topRule">
Simplified header for stand-alone grammars
Without the DTD and schema, the stand-alone grammar header can be less complex:
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar"
version="1.0"
mode="voice"
xml:lang="en"
type="application/srgs+xml"
tag-format="semantics/1.0"
root="topRule">
Inline grammar header example
<grammar version="1.0"
mode="voice"
xml:lang="en-US"
type="application/srgs+xml"
tag-format="semantics/1.0"
root="topRule">