public interface GrammarProcessor extends Configurable
GrammarProcessor is the main entry point for
grammar processing.
This class provides a lean method interface to process a grammar in a VoiceXML file.
| Modifier and Type | Method and Description |
|---|---|
GrammarDocument |
process(VoiceXmlInterpreterContext context,
FetchAttributes attributes,
org.jvoicexml.xml.srgs.Grammar grammar,
java.util.Locale language)
Give in grammar into this processor and let it do it's job.
|
initGrammarDocument process(VoiceXmlInterpreterContext context, FetchAttributes attributes, org.jvoicexml.xml.srgs.Grammar grammar, java.util.Locale language) throws NoresourceError, BadFetchError, UnsupportedFormatError, SemanticError
Ok, to be a more specific, here is a short briefing, what is done to the grammar:
First of all, the grammar node is going to be walked along to check it's attributes and children. If it has a "src" attribut as well as an inline grammar an "error.badfetch" is thrown.
External grammars referenced by the src attribute as well as
external rule expansions are going to be fetched. This is done
in a loop until all external grammars are loaded.
While fetching all grammars one by one, the type and language
is going to be checked.
If a unsupported grammar type is referenced an
"UnsupportedFormatError" is thrown.
If a grammar for an unsupported language is fetched
"UnsupportedLanguageError" is thrown.
context - the current context.attributes - attributes governing the fetch.grammar - the grammar to processlanguage - the default xml:lang attributeNoresourceError - Error accessing the input device.UnsupportedFormatError - If an unsupported grammar has to be processed.BadFetchError - If the document could not be fetched successfully.SemanticError - if there was an error evaluating a scripting expression