org.jvoicexml.interpreter
Interface SsmlParsingStrategy

All Superinterfaces:
Cloneable

public interface SsmlParsingStrategy
extends Cloneable

Strategy to evaluate the contents of a VoiceXML tag within a <prompt> tag into an SSML document that can be sent to the speech synthesizer.

The main purpose is to evaluate all expressions. Since the task is very similar to evaluating a tag with a TagStrategy it is advisable to use a single source for evaluation of the tags.

Execution of an SsmlParsingStrategy comprises the following steps:

  1. clone()
    Create a working copy from the template.
  2. getAttributes(VoiceXmlInterpreterContext, FormInterpretationAlgorithm, VoiceXmlNode)
    Retrieve the current attributes from the node.
  3. evalAttributes(org.jvoicexml.interpreter.VoiceXmlInterpreterContext)
    Evaluate attributes, that need to be evaluated by the current script context
  4. validateAttributes
    Check, if all necessary information are present.
  5. cloneNode(SsmlParser, ScriptingEngine, SsmlDocument, SsmlNode, VoiceXmlNode)
    Clone the node into the target structure.

Since:
0.6
Version:
$Revision: 2670 $
Author:
Dirk Schnelle

Method Summary
 Object clone()
          Creates a new instance of this strategy.
 SsmlNode cloneNode(SsmlParser parser, ScriptingEngine scripting, SsmlDocument document, SsmlNode parent, VoiceXmlNode node)
          Creates a clone of this node in the given document.
 void evalAttributes(VoiceXmlInterpreterContext context)
          Evaluates all attributes which have to be evaluated by the scripting environment.
 void getAttributes(VoiceXmlInterpreterContext context, FormInterpretationAlgorithm fia, VoiceXmlNode node)
          Retrieves all attributes specified by the given node or by a <property> tag and stores their values in the working copy of this strategy.
 Collection<String> getEvalAttributes()
          Retrieves the names of all attributes, which have to be evaluated by the scripting environment.
 void validateAttributes()
          Validates the attributes of the current node.
 

Method Detail

clone

Object clone()
Creates a new instance of this strategy.

Returns:
new instance.

getEvalAttributes

Collection<String> getEvalAttributes()
Retrieves the names of all attributes, which have to be evaluated by the scripting environment.

Returns:
Names of all attributes to be evaluated, null if the related node has not attributes to be evaluated.

getAttributes

void getAttributes(VoiceXmlInterpreterContext context,
                   FormInterpretationAlgorithm fia,
                   VoiceXmlNode node)
Retrieves all attributes specified by the given node or by a <property> tag and stores their values in the working copy of this strategy.

Parameters:
context - The current VoiceXML interpreter context.
fia - The current form interpretation algorithm, maybe null if there is no current fia.
node - The node to process.

evalAttributes

void evalAttributes(VoiceXmlInterpreterContext context)
                    throws SemanticError
Evaluates all attributes which have to be evaluated by the scripting environment.

Parameters:
context - The current VoiceXML interpreter context.
Throws:
SemanticError - Error evaluating a variable.

validateAttributes

void validateAttributes()
                        throws ErrorEvent
Validates the attributes of the current node. Check, if all needed attributes are provided.

Throws:
ErrorEvent - Validation failed.

cloneNode

SsmlNode cloneNode(SsmlParser parser,
                   ScriptingEngine scripting,
                   SsmlDocument document,
                   SsmlNode parent,
                   VoiceXmlNode node)
                   throws SemanticError
Creates a clone of this node in the given document.

Parameters:
parser - the SSML parser.
scripting - reference to the scripting engine to evaluate scripting expressions.
document - the SSML target document.
parent - parent node of the node to clone.
node - the node to clone.
Returns:
cloned node, a value of null may be returned to indicate that the child nodes of node need no further processing.
Throws:
SemanticError - Error evaluating the node.


Copyright © 2005-2010JVoiceXML group.