|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jvoicexml.xml.AbstractXmlNode
org.jvoicexml.xml.srgs.Grammar
public final class Grammar
The <grammar> element is used to provide a speech grammar that
| Field Summary | |
|---|---|
static String |
ATTRIBUTE_FETCHHINT
This defaults to the grammarfetchhint property. |
static String |
ATTRIBUTE_FETCHTIMEOUT
This defaults to the fetchtimeout property. |
static String |
ATTRIBUTE_MAXAGE
This defaults to the grammarmaxage property. |
static String |
ATTRIBUTE_MAXSTALE
This defaults to the grammarmaxstale property. |
static String |
ATTRIBUTE_MODE
Defines the mode of the grammar following the modes of the W3C Speech Recognition Grammar Specification. |
protected static ArrayList<String> |
ATTRIBUTE_NAMES
Supported attribute names for this node. |
static String |
ATTRIBUTE_ROOT
Defines the rule which acts as the root rule of the grammar. |
static String |
ATTRIBUTE_SCOPE
Either "document", which makes the grammar active in all dialogs of the current document (and relevant application leaf documents), or "dialog", to make the grammar active throughout the current form. |
static String |
ATTRIBUTE_SRC
The URI specifying the location of the grammar and optionally a rulename within that grammar, if it is external. |
static String |
ATTRIBUTE_SRCEXPR
Equivalent to src, except that the URI is dynamically determined by evaluating the given ECMAScript expression in the current scope (e.g. the current form item). |
static String |
ATTRIBUTE_TAG_FORMAT
Defines the tag content format for all tags within the grammar. |
static String |
ATTRIBUTE_TYPE
The preferred media type of the grammar. |
static String |
ATTRIBUTE_VERSION
Defines the version of the grammar. |
static String |
ATTRIBUTE_WEIGHT
Specifies the weight of the grammar. |
static String |
ATTRIBUTE_XML_BASE
Declares the base URI from which relative URIs in the grammar are resolved. |
static String |
ATTRIBUTE_XML_LANG
The language identifier for the grammar. |
static String |
ATTRIBUTE_XMLNS
The designated namespace for VoiceXXML (required). |
static String |
DEFAULT_VERSION
Constant for version 1.0. |
static String |
DEFAULT_XMLNS
Default namespace. |
static String |
SCOPE_DIALOG
Scope dialog, which makes the grammar active throughout the current form.. |
static String |
SCOPE_DOCUMENT
Scope document, which makes the grammar active in all dialogs of the current document (and relevant application leaf documents). |
static String |
TAG_NAME
Name of the grammar tag. |
| Constructor Summary | |
|---|---|
Grammar()
Construct a new grammar object without a node. |
|
| Method Summary | |
|---|---|
CDATASection |
addCData(String data)
Creates a new CDATA section within this grammar. |
Text |
addText(String text)
Create a new text within this grammar. |
protected boolean |
canContainChild(String tagName)
Can the specified sub-tag be contained within this node? |
Collection<String> |
getAttributeNames()
Returns a collection of permitted attribute names for the node. |
String |
getFetchhint()
Retrieve the fetchhint attribute. |
String |
getFetchtimeout()
Retrieve the fetchtimeout attribute. |
long |
getFetchTimeoutAsMsec()
Retrieves the fetchtimeout attribute as msec. |
long |
getMastaleAsMsec()
Retrieves the maxstale attribute as msec. |
String |
getMaxage()
Retrieve the maxage attribute. |
long |
getMaxageAsMsec()
Retrieves the maxage attribute as msec. |
String |
getMaxstale()
Retrieve the maxstale attribute. |
ModeType |
getMode()
Retrieves the mode attribute. |
String |
getModename()
Retrieves the mode attribute. |
Collection<Rule> |
getPublicRules()
Retrieves all public rule nodes. |
String |
getRoot()
Retrieve sthe root attribute. |
Rule |
getRootRule()
Retrieves the root rule node. |
Rule |
getRule(String name)
Retrieves the rule node with the given name. |
Collection<Rule> |
getRules()
Retrieves all rule nodes. |
String |
getScope()
Retrieve the scope attribute. |
String |
getSrc()
Retrieve the src attribute. |
String |
getSrcexpr()
Retrieve the srcexpr attribute. |
URI |
getSrcUri()
Retrieve the src attribute as a URI. |
URL |
getSrcUrl()
Retrieve the src attribute as a URL. |
String |
getTagFormat()
Retrieve the tag-format attribute. |
String |
getTagName()
Get the name of the tag for the derived node. |
GrammarType |
getType()
Retrieves the type attribute. |
String |
getTypename()
Retrieves the type attribute. |
String |
getVersion()
Retrieve the version attribute. |
String |
getWeight()
Retrieve the weight attribute. |
String |
getXmlBase()
Retrieve the xml:base attribute. |
String |
getXmlLang()
Retrieve the xml:lang attribute. |
Locale |
getXmlLangObject()
Retrieve the xml:lang attribute. |
boolean |
isExternalGrammar()
This method checks, if this grammar is an external grammar or an inline grammar. |
XmlNode |
newInstance(Node n,
XmlNodeFactory<? extends XmlNode> factory)
Create a new instance for the given node. |
void |
setFetchhint(String fetchhint)
Set the fetchhint attribute. |
void |
setFetchtimeout(String fetchtimeout)
Set the fetchtimeout attribute. |
void |
setMaxage(String maxage)
Set the maxage attribute. |
void |
setMaxstale(String maxstale)
Set the maxstale attribute. |
void |
setMode(ModeType mode)
Sets the mode attribute. |
void |
setMode(String mode)
Set the mode attribute. |
void |
setRoot(Rule rule)
Sets the root attribute to the id of the given rule. |
void |
setRoot(String root)
Sets the root attribute. |
void |
setScope(String scope)
Set the scope attribute. |
void |
setSrc(String src)
Set the src attribute. |
void |
setSrc(URI uri)
Set the src attribute to the given URL. |
void |
setSrc(URL url)
Set the src attribute to the given URL. |
void |
setSrcexpr(String srcexpr)
Set the srcexpr attribute. |
void |
setTagFormat(String tagFormat)
Set the tag-format attribute. |
void |
setType(GrammarType type)
Sets the type attribute. |
void |
setType(String type)
Sets the type attribute. |
void |
setVersion(String version)
Set the version attribute. |
void |
setWeight(String weight)
Set the weight attribute. |
void |
setXmlBase(String xmlBase)
Set the xml:base attribute. |
void |
setXmlLang(Locale locale)
Set the xml:lang attribute. |
void |
setXmlLang(String xmlLang)
Set the xml:lang attribute. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jvoicexml.xml.XmlNode |
|---|
addChild, getAttribute, getChildNodes, getChildren, getNode, setAttribute |
| Methods inherited from interface org.w3c.dom.Node |
|---|
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
| Field Detail |
|---|
public static final String TAG_NAME
public static final String DEFAULT_XMLNS
ATTRIBUTE_XMLNS,
Constant Field Valuespublic static final String ATTRIBUTE_XMLNS
DEFAULT_XMLNS
public static final String ATTRIBUTE_VERSION
public static final String DEFAULT_VERSION
public static final String ATTRIBUTE_XML_LANG
public static final String ATTRIBUTE_MODE
public static final String ATTRIBUTE_ROOT
public static final String ATTRIBUTE_TAG_FORMAT
public static final String ATTRIBUTE_XML_BASE
<vxml> base URI declaration. If a local declaration
is omitted, the value is inherited down the document hierarchy.
public static final String ATTRIBUTE_SRC
public static final String ATTRIBUTE_SCOPE
SCOPE_DOCUMENT,
SCOPE_DIALOG,
Constant Field Valuespublic static final String SCOPE_DOCUMENT
ATTRIBUTE_SCOPE,
SCOPE_DIALOG,
Constant Field Valuespublic static final String SCOPE_DIALOG
ATTRIBUTE_SCOPE,
SCOPE_DOCUMENT,
Constant Field Valuespublic static final String ATTRIBUTE_TYPE
public static final String ATTRIBUTE_WEIGHT
public static final String ATTRIBUTE_FETCHHINT
public static final String ATTRIBUTE_FETCHTIMEOUT
public static final String ATTRIBUTE_MAXAGE
public static final String ATTRIBUTE_MAXSTALE
public static final String ATTRIBUTE_SRCEXPR
protected static final ArrayList<String> ATTRIBUTE_NAMES
| Constructor Detail |
|---|
public Grammar()
This is necessary for the node factory.
VoiceXmlNodeFactory| Method Detail |
|---|
public String getTagName()
getTagName in interface XmlNode
public XmlNode newInstance(Node n,
XmlNodeFactory<? extends XmlNode> factory)
Each XmlNode can serve as a prototype in a
XmlNodeFactory to produce a collection of
child nodes. Factories can then use the prototype pattern to
produce new nodes.
newInstance in interface XmlNoden - The node to encapsulate.factory - the factroy that calls this method.
XmlNodeFactorypublic String getVersion()
ATTRIBUTE_VERSIONpublic void setVersion(String version)
version - Value of the version attribute.ATTRIBUTE_VERSIONpublic String getModename()
ATTRIBUTE_MODEpublic ModeType getMode()
ATTRIBUTE_MODEpublic void setMode(String mode)
mode - Value of the mode attribute.ATTRIBUTE_MODEpublic void setMode(ModeType mode)
mode - Value of the mode attribute.ATTRIBUTE_MODEpublic String getRoot()
ATTRIBUTE_ROOTpublic void setRoot(String root)
root - Value of the root attribute.ATTRIBUTE_ROOTpublic void setRoot(Rule rule)
rule - the root rulepublic Rule getRootRule()
null if the node could not be found.public Collection<Rule> getRules()
public Collection<Rule> getPublicRules()
public Rule getRule(String name)
name - name of the rule to retrieve.
null if there is
no rule with that name.public String getTagFormat()
ATTRIBUTE_TAG_FORMATpublic void setTagFormat(String tagFormat)
tagFormat - Value of the tag-format attribute.ATTRIBUTE_TAG_FORMATpublic String getXmlLang()
ATTRIBUTE_XML_LANGpublic Locale getXmlLangObject()
ATTRIBUTE_XML_LANGpublic void setXmlLang(String xmlLang)
xmlLang - Value of the xml:lang attribute.ATTRIBUTE_XML_LANGpublic void setXmlLang(Locale locale)
locale - Value of the xml:lang attribute.ATTRIBUTE_XML_LANGpublic String getXmlBase()
ATTRIBUTE_XML_BASEpublic void setXmlBase(String xmlBase)
xmlBase - Value of the xml:base attribute.ATTRIBUTE_XML_BASEpublic String getSrc()
ATTRIBUTE_SRC
public URL getSrcUrl()
throws MalformedURLException
MalformedURLException - src value can not be evaluated to a URL.ATTRIBUTE_SRC
public URI getSrcUri()
throws URISyntaxException
URISyntaxException - src value can not be evaluated to a URL.ATTRIBUTE_SRCpublic void setSrc(String src)
src - Value of the src attribute.ATTRIBUTE_SRCpublic void setSrc(URL url)
url - URL of the src attribute.ATTRIBUTE_SRCpublic void setSrc(URI uri)
uri - URI of the src attribute.ATTRIBUTE_SRCpublic String getScope()
ATTRIBUTE_SCOPEpublic void setScope(String scope)
scope - Value of the scope attribute.ATTRIBUTE_SCOPEpublic String getTypename()
ATTRIBUTE_TYPEpublic GrammarType getType()
ATTRIBUTE_TYPEpublic void setType(String type)
type - Value of the type attribute.ATTRIBUTE_TYPEpublic void setType(GrammarType type)
type - Value of the type attribute.ATTRIBUTE_TYPEpublic String getWeight()
ATTRIBUTE_WEIGHTpublic void setWeight(String weight)
weight - Value of the weight attribute.ATTRIBUTE_WEIGHTpublic String getFetchhint()
ATTRIBUTE_FETCHHINTpublic void setFetchhint(String fetchhint)
fetchhint - Value of the fetchhint attribute.ATTRIBUTE_FETCHHINTpublic String getFetchtimeout()
ATTRIBUTE_FETCHTIMEOUTpublic long getFetchTimeoutAsMsec()
-1 if the value can not
be converted to a number.public void setFetchtimeout(String fetchtimeout)
fetchtimeout - Value of the fetchtimeout attribute.ATTRIBUTE_FETCHTIMEOUTpublic String getMaxage()
ATTRIBUTE_MAXAGEpublic long getMaxageAsMsec()
-1 if the value can not
be converted to a number.public void setMaxage(String maxage)
maxage - Value of the maxage attribute.ATTRIBUTE_MAXAGEpublic String getMaxstale()
ATTRIBUTE_MAXSTALEpublic long getMastaleAsMsec()
-1 if the value can not
be converted to a number.public void setMaxstale(String maxstale)
maxstale - Value of the maxstale attribute.ATTRIBUTE_MAXSTALEpublic String getSrcexpr()
ATTRIBUTE_SRCEXPRpublic void setSrcexpr(String srcexpr)
srcexpr - Value of the srcexpr attribute.ATTRIBUTE_SRCEXPRpublic Text addText(String text)
text - The text to be added.
public CDATASection addCData(String data)
data - the CDATA to be added
protected boolean canContainChild(String tagName)
canContainChild in class AbstractXmlNodetagName - Name of child.
public Collection<String> getAttributeNames()
getAttributeNames in interface XmlNodegetAttributeNames in class AbstractXmlNode
public boolean isExternalGrammar()
throws IllegalAttributeException
true, if the grammar is external, else
false
IllegalAttributeException - Exactly one of "src", "srcexpr", or an inline grammar
must be specified; otherwise, an error.badfetch event
is thrown.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||