org.jvoicexml.xml.vxml
Class Choice

java.lang.Object
  extended by org.jvoicexml.xml.XmlNode
      extended by org.jvoicexml.xml.vxml.VoiceXmlNode
          extended by org.jvoicexml.xml.vxml.Choice
All Implemented Interfaces:
XmlWritable, Node

public final class Choice
extends VoiceXmlNode

Define a menu item. The <choice> element serves several purposes:

Version:
$Revision: 1.6 $

Copyright © 2005 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Steve Doyle
See Also:
Enumerate, Form, Grammar

Field Summary
static String ATTRIBUTE_ACCEPT
          Override the setting for accept in <menu> for this particular choice.
static String ATTRIBUTE_DTMF
          The DTMF sequence for this choice.
static String ATTRIBUTE_EVENT
          Specify an event to be thrown instead of specifying a next.
static String ATTRIBUTE_EVENTEXPR
          An ECMAScript expression evaluating to the name of the event to be thrown.
static String ATTRIBUTE_EXPR
          Specify an expression to evaluate as a URI to transition to instead of specifying a next.
static String ATTRIBUTE_FETCHAUDIO
          The URI of the audio clip to play while the fetch is being done.
static String ATTRIBUTE_FETCHHINT
          Defines when the interpreter context should retrieve content from the server. prefetch indicates a file may be downloaded when the page is loaded, whereas safe indicates a file that should only be downloaded when actually needed.
static String ATTRIBUTE_FETCHTIMEOUT
          The interval to wait for the content to be returned before throwing an error.badfetch event.
static String ATTRIBUTE_MAXAGE
          Indicates that the document is willing to use content whose age is no greater than the specified time in seconds.
static String ATTRIBUTE_MAXSTALE
          Indicates that the document is willing to use content that has exceeded its expiration time.
static String ATTRIBUTE_MESSAGE
          A message string providing additional context about the event being thrown.
static String ATTRIBUTE_MESSAGEEXPR
          An ECMAScript expression evaluating to the message string.
protected static ArrayList<String> ATTRIBUTE_NAMES
          Supported attribute names for this node.
static String ATTRIBUTE_NEXT
          The URI of next dialog or document.
private static Set<String> CHILD_TAGS
          Valid child tags for this node.
static String TAG_NAME
          Name of the tag.
 
Fields inherited from class org.jvoicexml.xml.XmlNode
node
 
Fields inherited from interface org.w3c.dom.Node
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 Summary
Choice()
          Construct a new choice object without a node.
Choice(Node node)
          Construct a new choice object.
 
Method Summary
 Text addText(String text)
          Create a new text within this node.
protected  boolean canContainChild(String tagName)
          Can the specified sub-tag be contained within this node?
 String getAccept()
          Retrieve the accept attribute.
 Collection<String> getAttributeNames()
          Returns a collection of permitted attribute names for the node.
 String getDtmf()
          Retrieve the dtmf attribute.
 String getEvent()
          Retrieve the event attribute.
 String getEventexpr()
          Retrieve the eventexpr attribute.
 String getExpr()
          Retrieve the expr attribute.
 String getFetchaudio()
          Retrieve the fetchaudio attribute.
 String getFetchhint()
          Retrieve the fetchhint attribute.
 String getFetchtimeout()
          Retrieve the fetchtimeout attribute.
 String getMaxage()
          Retrieve the maxage attribute.
 String getMaxstale()
          Retrieve the maxstale attribute.
 String getMessage()
          Retrieve the message attribute.
 String getMessageexpr()
          Retrieve the messageexpr attribute.
 String getNext()
          Retrieve the next attribute.
 String getTagName()
          Get the name of the tag for the derived node.
 VoiceXmlNode newInstance(Node n)
          Create a new instance for the given node.
 void setAccept(String accept)
          Set the accept attribute.
 void setDtmf(String dtmf)
          Set the dtmf attribute.
 void setEvent(String event)
          Set the event attribute.
 void setEventexpr(String eventexpr)
          Set the eventexpr attribute.
 void setExpr(String expr)
          Set the expr attribute.
 void setFetchaudio(String fetchaudio)
          Set the fetchaudio attribute.
 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 setMessage(String message)
          Set the message attribute.
 void setMessageexpr(String messageexpr)
          Set the messageexpr attribute.
 void setNext(String next)
          Set the next attribute.
 
Methods inherited from class org.jvoicexml.xml.vxml.VoiceXmlNode
getChildNodes, getFirstChild, getLastChild, getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.jvoicexml.xml.XmlNode
addChild, appendChild, cloneNode, compareDocumentPosition, getAttribute, getAttributes, getBaseURI, getChildNodes, getFeature, getLocalName, getNamespaceURI, getNode, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getPrefix, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setAttribute, setNodeValue, setPrefix, setTextContent, setUserData, toString, writeChildrenXml, writeXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TAG_NAME

public static final String TAG_NAME
Name of the tag.

See Also:
Constant Field Values

ATTRIBUTE_DTMF

public static final String ATTRIBUTE_DTMF
The DTMF sequence for this choice. It is equivalent to a simple 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 #".

See Also:
Constant Field Values

ATTRIBUTE_ACCEPT

public static final String ATTRIBUTE_ACCEPT
Override the setting for accept in <menu> for this particular choice. When set to "exact" (the default), the text of the choice element defines the exact phrase to be recognized. When set to "approximate", the text of the choice element defines an approximate recognition phrase.

See Also:
Constant Field Values

ATTRIBUTE_NEXT

public static final String ATTRIBUTE_NEXT
The URI of next dialog or document.

See Also:
Constant Field Values

ATTRIBUTE_EXPR

public static final String ATTRIBUTE_EXPR
Specify an expression to evaluate as a URI to transition to instead of specifying a next.

See Also:
Constant Field Values

ATTRIBUTE_EVENT

public static final String ATTRIBUTE_EVENT
Specify an event to be thrown instead of specifying a next.

See Also:
Constant Field Values

ATTRIBUTE_EVENTEXPR

public static final String ATTRIBUTE_EVENTEXPR
An ECMAScript expression evaluating to the name of the event to be thrown.

See Also:
Constant Field Values

ATTRIBUTE_MESSAGE

public static final String ATTRIBUTE_MESSAGE
A message string providing additional context about the event being thrown.

See Also:
Constant Field Values

ATTRIBUTE_MESSAGEEXPR

public static final String ATTRIBUTE_MESSAGEEXPR
An ECMAScript expression evaluating to the message string.

See Also:
Constant Field Values

ATTRIBUTE_FETCHAUDIO

public static final String ATTRIBUTE_FETCHAUDIO
The URI of the audio clip to play while the fetch is being done. If not specified, the fetchaudio property is used, and if that property is not set, no audio is played during the fetch. The fetching of the audio clip is governed by the audiofetchhint, audiomaxage, audiomaxstale, and fetchtimeout properties in effect at the time of the fetch. The playing of the audio clip is governed by the fetchaudiodelay, and fetchaudiominimum properties in effect at the time of the fetch.

See Also:
Constant Field Values

ATTRIBUTE_FETCHTIMEOUT

public static final String ATTRIBUTE_FETCHTIMEOUT
The interval to wait for the content to be returned before throwing an error.badfetch event. This defaults to the fetchtimeout property.

See Also:
Constant Field Values

ATTRIBUTE_FETCHHINT

public static final String ATTRIBUTE_FETCHHINT
Defines when the interpreter context should retrieve content from the server. prefetch indicates a file may be downloaded when the page is loaded, whereas safe indicates a file that should only be downloaded when actually needed. This defaults to the audiofetchhint property.

See Also:
Constant Field Values

ATTRIBUTE_MAXAGE

public static final String ATTRIBUTE_MAXAGE
Indicates that the document is willing to use content whose age is no greater than the specified time in seconds. The document is not willing to use stale content, unless maxstale is also provided. This defaults to the audiomaxage property.

See Also:
Constant Field Values

ATTRIBUTE_MAXSTALE

public static final String ATTRIBUTE_MAXSTALE
Indicates that the document is willing to use content that has exceeded its expiration time. If maxstale is assigned a value, then the document is willing to accept content that has exceeded its expiration time by no more than the specified number of seconds. This defaults to the audiomaxstale property.

See Also:
Constant Field Values

ATTRIBUTE_NAMES

protected static final ArrayList<String> ATTRIBUTE_NAMES
Supported attribute names for this node.


CHILD_TAGS

private static final Set<String> CHILD_TAGS
Valid child tags for this node.

Constructor Detail

Choice

public Choice()
Construct a new choice object without a node.

This is necessary for the node factory.

See Also:
VoiceXmlNodeFactory

Choice

Choice(Node node)
Construct a new choice object.

Parameters:
node - The encapsulated node.
Method Detail

getTagName

public String getTagName()
Get the name of the tag for the derived node.

Specified by:
getTagName in class XmlNode
Returns:
name of the tag.

newInstance

public VoiceXmlNode newInstance(Node n)
Create a new instance for the given node.

Specified by:
newInstance in class XmlNode
Parameters:
n - The node to encapsulate.
Returns:
The new instance.

getDtmf

public String getDtmf()
Retrieve the dtmf attribute.

Returns:
Value of the dtmf attribute.
See Also:
ATTRIBUTE_DTMF

setDtmf

public void setDtmf(String dtmf)
Set the dtmf attribute.

Parameters:
dtmf - Value of the dtmf attribute.
See Also:
ATTRIBUTE_DTMF

getAccept

public String getAccept()
Retrieve the accept attribute.

Returns:
Value of the accept attribute.
See Also:
ATTRIBUTE_ACCEPT

setAccept

public void setAccept(String accept)
Set the accept attribute.

Parameters:
accept - Value of the accept attribute.
See Also:
ATTRIBUTE_ACCEPT

getNext

public String getNext()
Retrieve the next attribute.

Returns:
Value of the next attribute.
See Also:
ATTRIBUTE_NEXT

setNext

public void setNext(String next)
Set the next attribute.

Parameters:
next - Value of the next attribute.
See Also:
ATTRIBUTE_NEXT

getExpr

public String getExpr()
Retrieve the expr attribute.

Returns:
Value of the expr attribute.
See Also:
ATTRIBUTE_EXPR

setExpr

public void setExpr(String expr)
Set the expr attribute.

Parameters:
expr - Value of the expr attribute.
See Also:
ATTRIBUTE_EXPR

getEvent

public String getEvent()
Retrieve the event attribute.

Returns:
Value of the event attribute.
See Also:
ATTRIBUTE_EVENT

setEvent

public void setEvent(String event)
Set the event attribute.

Parameters:
event - Value of the event attribute.
See Also:
ATTRIBUTE_EVENT

getEventexpr

public String getEventexpr()
Retrieve the eventexpr attribute.

Returns:
Value of the eventexpr attribute.
See Also:
ATTRIBUTE_EVENTEXPR

setEventexpr

public void setEventexpr(String eventexpr)
Set the eventexpr attribute.

Parameters:
eventexpr - Value of the eventexpr attribute.
See Also:
ATTRIBUTE_EVENTEXPR

getMessage

public String getMessage()
Retrieve the message attribute.

Returns:
Value of the message attribute.
See Also:
ATTRIBUTE_MESSAGE

setMessage

public void setMessage(String message)
Set the message attribute.

Parameters:
message - Value of the message attribute.
See Also:
ATTRIBUTE_MESSAGE

getMessageexpr

public String getMessageexpr()
Retrieve the messageexpr attribute.

Returns:
Value of the messageexpr attribute.
See Also:
ATTRIBUTE_MESSAGEEXPR

setMessageexpr

public void setMessageexpr(String messageexpr)
Set the messageexpr attribute.

Parameters:
messageexpr - Value of the messageexpr attribute.
See Also:
ATTRIBUTE_MESSAGEEXPR

getFetchaudio

public String getFetchaudio()
Retrieve the fetchaudio attribute.

Returns:
Value of the fetchaudio attribute.
See Also:
ATTRIBUTE_FETCHAUDIO

setFetchaudio

public void setFetchaudio(String fetchaudio)
Set the fetchaudio attribute.

Parameters:
fetchaudio - Value of the fetchaudio attribute.
See Also:
ATTRIBUTE_FETCHAUDIO

getFetchhint

public String getFetchhint()
Retrieve the fetchhint attribute.

Returns:
Value of the fetchhint attribute.
See Also:
ATTRIBUTE_FETCHHINT

setFetchhint

public void setFetchhint(String fetchhint)
Set the fetchhint attribute.

Parameters:
fetchhint - Value of the fetchhint attribute.
See Also:
ATTRIBUTE_FETCHHINT

getFetchtimeout

public String getFetchtimeout()
Retrieve the fetchtimeout attribute.

Returns:
Value of the fetchtimeout attribute.
See Also:
ATTRIBUTE_FETCHTIMEOUT

setFetchtimeout

public void setFetchtimeout(String fetchtimeout)
Set the fetchtimeout attribute.

Parameters:
fetchtimeout - Value of the fetchtimeout attribute.
See Also:
ATTRIBUTE_FETCHTIMEOUT

getMaxage

public String getMaxage()
Retrieve the maxage attribute.

Returns:
Value of the maxage attribute.
See Also:
ATTRIBUTE_MAXAGE

setMaxage

public void setMaxage(String maxage)
Set the maxage attribute.

Parameters:
maxage - Value of the maxage attribute.
See Also:
ATTRIBUTE_MAXAGE

getMaxstale

public String getMaxstale()
Retrieve the maxstale attribute.

Returns:
Value of the maxstale attribute.
See Also:
ATTRIBUTE_MAXSTALE

setMaxstale

public void setMaxstale(String maxstale)
Set the maxstale attribute.

Parameters:
maxstale - Value of the maxstale attribute.
See Also:
ATTRIBUTE_MAXSTALE

addText

public Text addText(String text)
Create a new text within this node.

Parameters:
text - The text to be added.
Returns:
The new created text.

canContainChild

protected boolean canContainChild(String tagName)
Can the specified sub-tag be contained within this node?

Specified by:
canContainChild in class XmlNode
Parameters:
tagName - Name of child.
Returns:
True if the sub-tag is allowed on this node.

getAttributeNames

public Collection<String> getAttributeNames()
Returns a collection of permitted attribute names for the node.

Overrides:
getAttributeNames in class XmlNode
Returns:
A collection of attribute names that are allowed for the node


Copyright © 2005 JVoiceXML group.