public final class Option extends AbstractXmlNode
<field>.
When a simple set of alternatives is all that is needed to specify the legal
input values for a field, it may be more convenient to use an option list
than a grammar. An option list is represented by a set of
<option> elements contained in a
<field> element. Each <option>
element contains PCDATA that is used to generate a speech grammar.
Field| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ATTRIBUTE_ACCEPT
When set to "exact" (the default), the text of the option element defines
the exact phrase to be recognized.
|
static java.lang.String |
ATTRIBUTE_DTMF
An optional DTMF sequence for this option.
|
protected static java.util.ArrayList<java.lang.String> |
ATTRIBUTE_NAMES
Supported attribute names for this node.
|
static java.lang.String |
ATTRIBUTE_VALUE
The string to assign to the field's form item variable when a user
selects this option, whether by speech or DTMF.
|
static java.lang.String |
TAG_NAME
Name of the tag.
|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE| Constructor and Description |
|---|
Option()
Construct a new option object without a node.
|
| Modifier and Type | Method and Description |
|---|---|
Text |
addText(java.lang.String text)
Create a new text within this node.
|
protected boolean |
canContainChild(java.lang.String tagName)
Can the specified sub-tag be contained within this node?
|
java.lang.String |
getAccept()
Retrieve the accept attribute.
|
java.util.Collection<java.lang.String> |
getAttributeNames()
Returns a collection of permitted attribute names for the node.
|
java.lang.String |
getDtmf()
Retrieve the dtmf attribute.
|
java.lang.String |
getTagName()
Get the name of the tag for the derived node.
|
java.lang.String |
getValue()
Retrieve the value attribute.
|
boolean |
hasDtmf()
Checks if there are any DTMF sequences associated with this option.
|
XmlNode |
newInstance(org.w3c.dom.Node n,
XmlNodeFactory<? extends XmlNode> factory)
Create a new instance for the given node.
|
void |
setAccept(java.lang.String accept)
Set the accept attribute.
|
void |
setDtmf(java.lang.String dtmf)
Set the dtmf attribute.
|
void |
setValue(java.lang.String value)
Set the value attribute.
|
addChild, addChild, appendChild, appendChild, appendDeepClone, cloneNode, compareDocumentPosition, equals, getAttribute, getAttributes, getBaseURI, getChildNodes, getChildNodes, getChildren, getDefinedAttributeNames, getFeature, getFirstChild, getFirstLevelTextContent, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNode, getNodeFactory, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getOwnerXmlDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttribute, hasAttributes, hasChildNodes, hashCode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setAttribute, setNodeValue, setPrefix, setTextContent, setUserData, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddChild, getAttribute, getChildNodes, getChildren, getNode, setAttributeappendChild, 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, setUserDatapublic static final java.lang.String TAG_NAME
public static final java.lang.String ATTRIBUTE_DTMF
<grammar> and DTMF properties apply to
recognition of the sequence. Unlike DTMF grammars, whitespace is
optional: dtmf="123#" is equivalent to dtmf="1 2 3 #". If unspecified, no
DTMF sequence is associated with this option so it cannot be matched
using DTMF.public static final java.lang.String ATTRIBUTE_ACCEPT
public static final java.lang.String ATTRIBUTE_VALUE
<option> element with
leading and trailing white space removed. If this does not exist, then
the DTMF sequence is used instead. If neither CDATA content nor a dtmf
sequence is specified, then the default assignment is undefined and the
field's form item variable is not filled.protected static final java.util.ArrayList<java.lang.String> ATTRIBUTE_NAMES
public Option()
This is necessary for the node factory.
VoiceXmlNodeFactorypublic java.lang.String getTagName()
public XmlNode newInstance(org.w3c.dom.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.
n - The node to encapsulate.factory - the factroy that calls this method.XmlNodeFactorypublic java.lang.String getDtmf()
ATTRIBUTE_DTMFpublic boolean hasDtmf()
true if a DTMF sequence is definedpublic void setDtmf(java.lang.String dtmf)
dtmf - Value of the dtmf attribute.ATTRIBUTE_DTMFpublic java.lang.String getAccept()
ATTRIBUTE_ACCEPTpublic void setAccept(java.lang.String accept)
accept - Value of the accept attribute.ATTRIBUTE_ACCEPTpublic java.lang.String getValue()
ATTRIBUTE_VALUEpublic void setValue(java.lang.String value)
value - Value of the value attribute.ATTRIBUTE_VALUEpublic Text addText(java.lang.String text)
text - The text to be added.protected boolean canContainChild(java.lang.String tagName)
canContainChild in class AbstractXmlNodetagName - Name of child.public java.util.Collection<java.lang.String> getAttributeNames()
getAttributeNames in interface XmlNodegetAttributeNames in class AbstractXmlNode