public final class SrgsAbnfGrammarIdentifier extends java.lang.Object implements GrammarIdentifier
application/srgs.| Constructor and Description |
|---|
SrgsAbnfGrammarIdentifier() |
| Modifier and Type | Method and Description |
|---|---|
org.jvoicexml.xml.srgs.GrammarType |
getSupportedType()
Returns the supported media type.
|
org.jvoicexml.xml.srgs.GrammarType |
identify(GrammarDocument grammar)
Identifies the grammar specified by
grammar. |
public org.jvoicexml.xml.srgs.GrammarType identify(GrammarDocument grammar)
grammar. If
grammar could be identified a type is returned, otherwise
null.
These are the rules for a valid ABDF Header:
The ABNF self-identifying header must be present in any legal stand-alone ABNF Form grammar document.
The first character of an ABNF document must be the "#" symbol (x23) unless preceded by an optional XML 1.0 byte order mark [XML Paragraph 4.3.3]. The ABNF byte order mark follows the XML definition and requirements. For example, documents encoded in UTF-16 must begin with the byte order mark.
The optional byte order mark and required "#" symbol must be followed immediately by the exact string "ABNF" (x41 x42 x4d x46) or the appropriate equivalent for the document's encoding (e.g. for UTF-16 little-endian: x23 x00 x41 x00 x42 x00 x4d x00 x46 x00). If the byte order mark is absent on a grammar encoded in UTF-16 then the grammar processor should perform auto-detection of character encoding in a manner analogous to auto-detection of character encoding in XML [XML Appendix F].
Next follows a single space character (x20) and the required version number which is "1.0" for this specification (x31 x2e x30).
Next follows an optional character encoding. Section 4.4 defines character encodings in more detail. If present, there must be a single space character (x20) between the version number and the character encoding.
The self-identifying header is finalized with a semicolon (x3b) followed immediately by a newline. The semicolon must be the first character following the version number or the character encoding if is present.
identify in interface GrammarIdentifiergrammar - The grammar to be identified.public org.jvoicexml.xml.srgs.GrammarType getSupportedType()
getSupportedType in interface GrammarIdentifier