org.jvoicexml.xml.ssml
Class Voice

java.lang.Object
  extended by org.jvoicexml.xml.AbstractXmlNode
      extended by org.jvoicexml.xml.ssml.Voice
All Implemented Interfaces:
SsmlNode, TextContainer, VoiceXmlNode, XmlNode, Node

public final class Voice
extends AbstractXmlNode
implements VoiceXmlNode, TextContainer

The voice element is a production element that requests a change in speaking voice.

Version:
$Revision: 2325 $
Author:
Steve Doyle, Dirk Schnelle-Walka

Field Summary
static String ATTRIBUTE_AGE
          Optional attribute indicating the preferred age in years (since birth) of the voice to speak the contained text.
static String ATTRIBUTE_GENDER
          Optional attribute indicating the preferred gender of the voice to speak the contained text.
static String ATTRIBUTE_NAME
          optional attribute indicating a preferred variant of the other voice characteristics to speak the contained text.
protected static ArrayList<String> ATTRIBUTE_NAMES
          Supported attribute names for this node.
static String ATTRIBUTE_VARIANT
          optional attribute indicating a preferred variant of the other voice characteristics to speak the contained text.
static String ATTRIBUTE_XML_LANG
          Optional language specification attribute.
static String TAG_NAME
          Name of the tag.
 
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
Voice()
          Construct a new voice object without a node.
 
Method Summary
 Text addText(String text)
          Creates a new text within this node.
protected  boolean canContainChild(String tagName)
          Can the specified sub-tag be contained within this node?
 String getAge()
          Retrieve the age attribute.
 int getAgeAsInt()
          Retrieves the age attribute as an integer.
 Collection<String> getAttributeNames()
          Returns a collection of permitted attribute names for the node.
 GenderType getGender()
          Retrieve the gender attribute.
 String getGenderName()
          Retrieve the gender attribute.
 String getName()
          Retrieve the name attribute.
 String getTagName()
          Get the name of the tag for the derived node.
 String getVariant()
          Retrieve the variant attribute.
 String getXmlLang()
          Retrieve the xml:lang attribute.
 XmlNode newInstance(Node n, XmlNodeFactory<? extends XmlNode> factory)
          Create a new instance for the given node.
 void setAge(int age)
          Set the age attribute.
 void setAge(String age)
          Set the age attribute.
 void setGender(GenderType gender)
          Set the gender attribute.
 void setGender(String gender)
          Set the gender attribute.
 void setName(String name)
          Set the name attribute.
 void setVariant(String variant)
          Set the variant attribute.
 void setXmlLang(String xmlLang)
          Set the xml:lang attribute.
 
Methods inherited from class org.jvoicexml.xml.AbstractXmlNode
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, hasAttributes, hasChildNodes, hashCode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setAttribute, setNodeValue, setPrefix, setTextContent, setUserData, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jvoicexml.xml.TextContainer
getNodeFactory
 
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

TAG_NAME

public static final String TAG_NAME
Name of the tag.

See Also:
Constant Field Values

ATTRIBUTE_XML_LANG

public static final String ATTRIBUTE_XML_LANG
Optional language specification attribute.

See Also:
Constant Field Values

ATTRIBUTE_GENDER

public static final String ATTRIBUTE_GENDER
Optional attribute indicating the preferred gender of the voice to speak the contained text. Enumerated values are: "male", "female", "neutral".

See Also:
Constant Field Values

ATTRIBUTE_AGE

public static final String ATTRIBUTE_AGE
Optional attribute indicating the preferred age in years (since birth) of the voice to speak the contained text.

See Also:
Constant Field Values

ATTRIBUTE_VARIANT

public static final String ATTRIBUTE_VARIANT
optional attribute indicating a preferred variant of the other voice characteristics to speak the contained text. (e.g. the second male child voice).

See Also:
Constant Field Values

ATTRIBUTE_NAME

public static final String ATTRIBUTE_NAME
optional attribute indicating a preferred variant of the other voice characteristics to speak the contained text. (e.g. the second male child voice).

See Also:
Constant Field Values

ATTRIBUTE_NAMES

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

Constructor Detail

Voice

public Voice()
Construct a new voice object without a node.

This is necessary for the node factory.

See Also:
VoiceXmlNodeFactory
Method Detail

getTagName

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

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

newInstance

public XmlNode newInstance(Node n,
                           XmlNodeFactory<? extends XmlNode> factory)
Create a new instance for the given node.

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.

Specified by:
newInstance in interface XmlNode
Parameters:
n - The node to encapsulate.
factory - the factroy that calls this method.
Returns:
The new instance.
See Also:
XmlNodeFactory

getXmlLang

public String getXmlLang()
Retrieve the xml:lang attribute.

Returns:
Value of the xml:lang attribute.
See Also:
ATTRIBUTE_XML_LANG

setXmlLang

public void setXmlLang(String xmlLang)
Set the xml:lang attribute.

Parameters:
xmlLang - Value of the xml:lang attribute.
See Also:
ATTRIBUTE_XML_LANG

getGenderName

public String getGenderName()
Retrieve the gender attribute.

Returns:
Value of the gender attribute.
See Also:
ATTRIBUTE_GENDER

getGender

public GenderType getGender()
Retrieve the gender attribute.

Returns:
Value of the gender attribute.
Since:
0.6
See Also:
ATTRIBUTE_GENDER

setGender

public void setGender(String gender)
Set the gender attribute.

Parameters:
gender - Value of the gender attribute.
See Also:
ATTRIBUTE_GENDER

setGender

public void setGender(GenderType gender)
Set the gender attribute.

Parameters:
gender - Value of the gender attribute.
Since:
0.6
See Also:
ATTRIBUTE_GENDER

getAge

public String getAge()
Retrieve the age attribute.

Returns:
Value of the age attribute.
See Also:
ATTRIBUTE_AGE

getAgeAsInt

public int getAgeAsInt()
Retrieves the age attribute as an integer.

Returns:
age, -1 if no age is specified.
Since:
0.6

setAge

public void setAge(String age)
Set the age attribute.

Parameters:
age - Value of the age attribute.
See Also:
ATTRIBUTE_AGE

setAge

public void setAge(int age)
Set the age attribute.

Parameters:
age - Value of the age attribute.
Since:
0.6
See Also:
ATTRIBUTE_AGE

getVariant

public String getVariant()
Retrieve the variant attribute.

Returns:
Value of the variant attribute.
See Also:
ATTRIBUTE_VARIANT

setVariant

public void setVariant(String variant)
Set the variant attribute.

Parameters:
variant - Value of the variant attribute.
See Also:
ATTRIBUTE_VARIANT

getName

public String getName()
Retrieve the name attribute.

Returns:
Value of the name attribute.
See Also:
ATTRIBUTE_NAME

setName

public void setName(String name)
Set the name attribute.

Parameters:
name - Value of the name attribute.
See Also:
ATTRIBUTE_NAME

addText

public Text addText(String text)
Creates a new text within this node. If the last child node already is a text node the given trimmed text is appended to that node.

Specified by:
addText in interface TextContainer
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 AbstractXmlNode
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.

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


Copyright © 2005-2009JVoiceXML group.