Location: PHPKode > scripts > PHP Voice > php-voice/vxml.class.php
<?php

/**
 * gonx_vxml class : 
 * 
 * @package GONX
 * @author Ben Yacoub Hatem <hide@address.com>
 * @copyright Copyright (c) 2004
 * @version $Id: vxml.class.php,v 1.8 2004/11/16 16:32:06 hatemben Exp $ - 2004-10-25 11:43:19 - vxml.class.php
 * @generator dtd2php version 1.0.1
 * @access public
 **/
class gonx_vxml{
	
	/**
     * Constructor
     *
     * @param encoding		Document encoding, default is UTF-8
     * @access protected
     */
	function gonx_vxml($encoding = "UTF-8"){
		$this->_document = "<?xml version=\"1.0\" encoding=\"$encoding\"?>\n";
	}

	var $_document;

	/*
	* Open  vxml tag.
	*
	* @param	application
	* @param	xml_base
	* @param	xml_lang

	* @param	xmlns_xsi
	* @param	xsi_schemaLocation
	* @param	version	this variable is required

	*/
	function start_vxml($application = "", $xml_base = "", $xml_lang = "", $xmlns_xsi = "", $xsi_schemaLocation = "", $version = "")
	{
		$resu = ("<vxml");

		if ((isset($application)) and ($application!=="")){
			$resu .= ' application="'.$application.'"';
		}
		if ((isset($xml_base)) and ($xml_base!=="")){
			$resu .= ' xml:base="'.$xml_base.'"';
		}
		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		$resu .= ' xmlns="http://www.w3.org/2001/vxml"';

		if ((isset($xmlns_xsi)) and ($xmlns_xsi!=="")){
			$resu .= ' xmlns:xsi="'.$xmlns_xsi.'"';
		}
		if ((isset($xsi_schemaLocation)) and ($xsi_schemaLocation!=="")){
			$resu .= ' xsi:schemaLocation="'.$xsi_schemaLocation.'"';
		}
		if ((isset($version)) and ($version!=="")){
			$resu .= ' version="'.$version.'"';
		} else {
			$resu .= ' <!-- Error occured in vxml. Need to pass "version"=... -->';
		}

		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  vxml tag.
	*
	*/
	function end_vxml()
	{
		$this->_document .= "</vxml>\n";
	}

	/*
	* Open  meta tag.
	*
	* @param	name
	* @param	content	this variable is required
	* @param	http_equiv

	*/
	function start_meta($name = "", $content = "", $http_equiv = "")
	{
		$resu = '<meta';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		}
		if ((isset($content)) and ($content!=="")){
			$resu .= ' content="'.$content.'"';
		} else {
			$resu .= ' <!-- Error occured in meta. Need to pass "content"=... -->';
		}

		if ((isset($http_equiv)) and ($http_equiv!=="")){
			$resu .= ' http-equiv="'.$http_equiv.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  meta tag.
	*
	*/
	function end_meta()
	{
		$this->_document .= "</meta>\n";
	}

	/*
	* Open  metadata tag.
	*/
	function start_metadata()
	{
		$this->_document .= "<metadata>\n";
	}
	
	/*
	* Close  metadata tag.
	*
	*/
	function end_metadata()
	{
		$this->_document .= "</metadata>\n";
	}

	/*
	* Open  prompt tag.
	*
	* @param	bargein
	* @param	bargeintype
	* @param	cond
	* @param	count
	* @param	xml_lang
	* @param	timeout
	* @param	xml_base


	*/
	function start_prompt($bargein = "", $bargeintype = "", $cond = "", $count = "", $xml_lang = "", $timeout = "", $xml_base = "")
	{
		$resu = ("<prompt");

		if ((isset($bargein)) and ($bargein!=="")){
			$resu .= ' bargein="'.$bargein.'"';
		}
		if ((isset($bargeintype)) and ($bargeintype!=="")){
			$resu .= ' bargeintype="'.$bargeintype.'"';
		}
		if ((isset($cond)) and ($cond!=="")){
			$resu .= ' cond="'.$cond.'"';
		}
		if ((isset($count)) and ($count!=="")){
			$resu .= ' count="'.$count.'"';
		}
		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		if ((isset($timeout)) and ($timeout!=="")){
			$resu .= ' timeout="'.$timeout.'"';
		}
		if ((isset($xml_base)) and ($xml_base!=="")){
			$resu .= ' xml:base="'.$xml_base.'"';
		}
//		$resu .= ' version = \'1.0\'';

		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  prompt tag.
	*
	*/
	function end_prompt()
	{
		$this->_document .= "</prompt>\n";
	}

	/*
	* Open  enumerate tag.
	*/
	function start_enumerate()
	{
		$this->_document .= "<enumerate>\n";
	}
	
	/*
	* Open  enumerate tag.
	*/
	function start_enumerate_c()
	{
		$this->_document .= "<enumerate/>\n";
	}
	
	/*
	* Close  enumerate tag.
	*
	*/
	function end_enumerate()
	{
		$this->_document .= "</enumerate>\n";
	}

	/*
	* Create  reprompt tag.
	*/
	function start_reprompt()
	{
		$this->_document .= "<reprompt />\n";
	}

	/*
	* Open  form tag.
	*
	* @param	id
	* @param	scope

	*/
	function start_form($id = "", $scope = "")
	{
		
		$resu = ("<form");

		if ((isset($id)) and ($id!=="")){
			$resu .= ' id="'.$id.'"';
		}
		if ((isset($scope)) and ($scope!=="")){
			$resu .= ' scope="'.$scope.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  form tag.
	*
	*/
	function end_form()
	{
		$this->_document .= "</form>\n";
	}

	/*
	* Open  menu tag.
	*
	* @param	id
	* @param	scope
	* @param	dtmf

	*/
	function start_menu($id = "", $scope = "", $dtmf = "")
	{
		$resu = ("<menu");

		if ((isset($id)) and ($id!=="")){
			$resu .= ' id="'.$id.'"';
		}
		if ((isset($scope)) and ($scope!=="")){
			$resu .= ' scope="'.$scope.'"';
		}
		if ((isset($dtmf)) and ($dtmf!=="")){
			$resu .= ' dtmf="'.$dtmf.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  menu tag.
	*
	*/
	function end_menu()
	{
		$this->_document .= "</menu>\n";
	}

	/*
	* Open  choice tag.
	*
	* @param	accept
	* @param	dtmf
	* @param	fetchaudio

	*/
	function start_choice($accept = "", $dtmf = "", $fetchaudio = "", $next = "")
	{
		$resu = ("<choice");

		if ((isset($accept)) and ($accept!=="")){
			$resu .= ' accept="'.$accept.'"';
		}
		if ((isset($dtmf)) and ($dtmf!=="")){
			$resu .= ' dtmf="'.$dtmf.'"';
		}
		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		
		if ((isset($next)) and ($next!=="")){
			$resu .= ' next="'.$next.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	function start_choice_c($accept = "", $dtmf = "", $fetchaudio = "", $next = "")
	{
		$resu = ("<choice");

		if ((isset($accept)) and ($accept!=="")){
			$resu .= ' accept="'.$accept.'"';
		}
		if ((isset($dtmf)) and ($dtmf!=="")){
			$resu .= ' dtmf="'.$dtmf.'"';
		}
		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		
		if ((isset($next)) and ($next!=="")){
			$resu .= ' next="'.$next.'"';
		}
		$resu .= ("/>\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  choice tag.
	*
	*/
	function end_choice()
	{
		$this->_document .= "</choice>\n";
	}

	/*
	* Open  p tag.
	*
	* @param	xml_lang

	*/
	function start_p($xml_lang = "")
	{
		$resu = ("<p");

		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  p tag.
	*
	*/
	function end_p()
	{
		$this->_document .= "</p>\n";
	}

	/*
	* Open  s tag.
	*
	* @param	xml_lang

	*/
	function start_s($xml_lang = "")
	{
		$resu = ("<s");

		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  s tag.
	*
	*/
	function end_s()
	{
		$this->_document .= "</s>\n";
	}

	/*
	* Open  voice tag.
	*
	* @param	xml_lang
	* @param	gender
	* @param	age
	* @param	variant
	* @param	name

	*/
	function start_voice($xml_lang = "", $gender = "", $age = "", $variant = "", $name = "")
	{
		$resu = ("<voice");

		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		if ((isset($gender)) and ($gender!=="")){
			$resu .= ' gender="'.$gender.'"';
		}
		if ((isset($age)) and ($age!=="")){
			$resu .= ' age="'.$age.'"';
		}
		if ((isset($variant)) and ($variant!=="")){
			$resu .= ' variant="'.$variant.'"';
		}
		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  voice tag.
	*
	*/
	function end_voice()
	{
		$this->_document .= "</voice>\n";
	}

	/*
	* Open  prosody tag.
	*
	* @param	pitch
	* @param	contour
	* @param	range
	* @param	rate
	* @param	duration
	* @param	volume

	*/
	function start_prosody($pitch = "", $contour = "", $range = "", $rate = "", $duration = "", $volume = "")
	{
		$resu = ("<prosody");

		if ((isset($pitch)) and ($pitch!=="")){
			$resu .= ' pitch="'.$pitch.'"';
		}
		if ((isset($contour)) and ($contour!=="")){
			$resu .= ' contour="'.$contour.'"';
		}
		if ((isset($range)) and ($range!=="")){
			$resu .= ' range="'.$range.'"';
		}
		if ((isset($rate)) and ($rate!=="")){
			$resu .= ' rate="'.$rate.'"';
		}
		if ((isset($duration)) and ($duration!=="")){
			$resu .= ' duration="'.$duration.'"';
		}
		if ((isset($volume)) and ($volume!=="")){
			$resu .= ' volume="'.$volume.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  prosody tag.
	*
	*/
	function end_prosody()
	{
		$this->_document .= "</prosody>\n";
	}

	/*
	* Open  audio tag.
	*
	* @param	src
	* @param	expr

	*/
	function start_audio($src = "", $expr = "")
	{
		$resu = ("<audio");

		if ((isset($src)) and ($src!=="")){
			$resu .= ' src="'.$src.'"';
		}
		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  audio tag.
	*
	*/
	function end_audio()
	{
		$this->_document .= "</audio>\n";
	}

	/*
	* Open  desc tag.
	*
	* @param	xml_lang

	*/
	function start_desc($xml_lang = "")
	{
		$resu = ("<desc");

		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  desc tag.
	*
	*/
	function end_desc()
	{
		$this->_document .= "</desc>\n";
	}

	/*
	* Open  emphasis tag.
	*
	* @param	level

	*/
	function start_emphasis($level = "")
	{
		$resu = ("<emphasis");

		if ((isset($level)) and ($level!=="")){
			$resu .= ' level="'.$level.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  emphasis tag.
	*
	*/
	function end_emphasis()
	{
		$this->_document .= "</emphasis>\n";
	}

	/*
	* Open  say_as tag.
	*
	* @param	interpret_as	this variable is required
	* @param	format
	* @param	detail

	*/
	function start_say_as($interpret_as = "", $format = "", $detail = "")
	{
		$resu = ("<say-as");

		if ((isset($interpret_as)) and ($interpret_as!=="")){
			$resu .= ' interpret-as="'.$interpret_as.'"';
		} else {
			$resu .= ' <!-- Error occured in say-as. Need to pass "interpret-as"=... -->';
		}

		if ((isset($format)) and ($format!=="")){
			$resu .= ' format="'.$format.'"';
		}
		if ((isset($detail)) and ($detail!=="")){
			$resu .= ' detail="'.$detail.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  say_as tag.
	*
	*/
	function end_say_as()
	{
		$this->_document .= "</say-as>\n";
	}

	/*
	* Open  sub tag.
	*
	* @param	alias	this variable is required

	*/
	function start_sub($alias = "")
	{
		$resu = ("<sub");

		if ((isset($alias)) and ($alias!=="")){
			$resu .= ' alias="'.$alias.'"';
		} else {
			$resu .= ' <!-- Error occured in sub. Need to pass "alias"=... -->';
		}

		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  sub tag.
	*
	*/
	function end_sub()
	{
		$this->_document .= "</sub>\n";
	}

	/*
	* Open  phoneme tag.
	*
	* @param	ph	this variable is required
	* @param	alphabet

	*/
	function start_phoneme($ph = "", $alphabet = "")
	{
		$resu = ("<phoneme");

		if ((isset($ph)) and ($ph!=="")){
			$resu .= ' ph="'.$ph.'"';
		} else {
			$resu .= ' <!-- Error occured in phoneme. Need to pass "ph"=... -->';
		}

		if ((isset($alphabet)) and ($alphabet!=="")){
			$resu .= ' alphabet="'.$alphabet.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  phoneme tag.
	*
	*/
	function end_phoneme()
	{
		$this->_document .= "</phoneme>\n";
	}

	/*
	* Open  break tag.
	*
	* @param	time
	* @param	strength
	* @param	size
	*/
	function start_break($time = "", $strength = "",$size = "")
	{
		$resu = '<break';

		if ((isset($time)) and ($time!=="")){
			$resu .= ' time="'.$time.'"';
		}
		if ((isset($strength)) and ($strength!=="")){
			$resu .= ' strength="'.$strength.'"';
		}
		if ((isset($size)) and ($size!=="")){
			$resu .= ' size="'.$size.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Open  break tag.
	*
	* @param	time
	* @param	strength
	* @param	size
	*/
	function start_break_c($time = "", $strength = "",$size = "")
	{
		$resu = '<break';

		if ((isset($time)) and ($time!=="")){
			$resu .= ' time="'.$time.'"';
		}
		if ((isset($strength)) and ($strength!=="")){
			$resu .= ' strength="'.$strength.'"';
		}
		if ((isset($size)) and ($size!=="")){
			$resu .= ' size="'.$size.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  break tag.
	*
	*/
	function end_break()
	{
		$this->_document .= "</break>\n";
	}

	/*
	* Open  mark tag.
	*
	* @param	name	this variable is required

	*/
	function start_mark($name = "")
	{
		$resu = '<mark';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in mark. Need to pass "name"=... -->';
		}

		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  mark tag.
	*
	*/
	function end_mark()
	{
		$this->_document .= "</mark>\n";
	}

	/*
	* Open  field tag.
	*
	* @param	type
	* @param	slot
	* @param	modal

	*/
	function start_field($name = "", $type = "", $slot = "", $modal = "")
	{
		$resu = ("<field");
		

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		}

		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		if ((isset($slot)) and ($slot!=="")){
			$resu .= ' slot="'.$slot.'"';
		}
		if ((isset($modal)) and ($modal!=="")){
			$resu .= ' modal="'.$modal.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  field tag.
	*
	*/
	function end_field()
	{
		$this->_document .= "</field>\n";
	}

	/*
	* Open  option tag.
	*
	* @param	dtmf
	* @param	value

	*/
	function start_option($dtmf = "", $value = "")
	{
		$resu = ("<option");

		if ((isset($dtmf)) and ($dtmf!=="")){
			$resu .= ' dtmf="'.$dtmf.'"';
		}
		if ((isset($value)) and ($value!=="")){
			$resu .= ' value="'.$value.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  option tag.
	*
	*/
	function end_option()
	{
		$this->_document .= "</option>\n";
	}

	/*
	* Open  var tag.
	*
	* @param	name	this variable is required
	* @param	expr

	*/
	function start_var($name = "", $expr = "")
	{
		$resu = '<var';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in var. Need to pass "name"=... -->';
		}

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	function start_var_c($name = "", $expr = "")
	{
		$resu = '<var';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in var. Need to pass "name"=... -->';
		}

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  var tag.
	*
	*/
	function end_var()
	{
		$this->_document .= "</var>\n";
	}

	/*
	* Open  assign tag.
	*
	* @param	name	this variable is required
	* @param	expr	this variable is required

	*/
	function start_assign($name = "", $expr = "")
	{
		$resu = '<assign';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in assign. Need to pass "name"=... -->';
		}

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		} else {
			$resu .= ' <!-- Error occured in assign. Need to pass "expr"=... -->';
		}

		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	function start_assign_c($name = "", $expr = "")
	{
		$resu = '<assign';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in assign. Need to pass "name"=... -->';
		}

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		} else {
			$resu .= ' <!-- Error occured in assign. Need to pass "expr"=... -->';
		}

		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  assign tag.
	*
	*/
	function end_assign()
	{
		$this->_document .= "</assign>\n";
	}

	/*
	* Open  clear tag.
	*
	* @param	namelist

	*/
	function start_clear($namelist = "")
	{
		$resu = '<clear';

		if ((isset($namelist)) and ($namelist!=="")){
			$resu .= ' namelist="'.$namelist.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  clear tag.
	*
	*/
	function end_clear()
	{
		$this->_document .= "</clear>\n";
	}

	/*
	* Open  value tag.
	*
	* @param	expr	this variable is required

	*/
	function start_value($expr = "")
	{
		$resu = '<value';

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		} else {
			$resu .= ' <!-- Error occured in value. Need to pass "expr"=... -->';
		}

		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	function start_value_c($expr = "")
	{
		$resu = '<value';

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		} else {
			$resu .= ' <!-- Error occured in value. Need to pass "expr"=... -->';
		}

		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  value tag.
	*
	*/
	function end_value()
	{
		$this->_document .= "</value>\n";
	}

	/*
	* Open  catch tag.
	*
	* @param	event

	*/
	function start_catch($event = "")
	{
		$resu = ("<catch");

		if ((isset($event)) and ($event!=="")){
			$resu .= ' event="'.$event.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  catch tag.
	*
	*/
	function end_catch()
	{
		$this->_document .= "</catch>\n";
	}

	/*
	* Open  link tag.
	*
	* @param	fetchaudio
	* @param	dtmf

	*/
	function start_link($fetchaudio = "", $dtmf = "")
	{
		$resu = ("<link");

		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		if ((isset($dtmf)) and ($dtmf!=="")){
			$resu .= ' dtmf="'.$dtmf.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  link tag.
	*
	*/
	function end_link()
	{
		$this->_document .= "</link>\n";
	}

	/*
	* Open  throw tag.
	*/
	function start_throw()
	{
		$this->_document .= "<throw>\n";
	}
	
	/*
	* Close  throw tag.
	*
	*/
	function end_throw()
	{
		$this->_document .= "</throw>\n";
	}

	/*
	* Open  ruleref tag.
	*
	* @param	uri
	* @param	type
	* @param	special

	*/
	function start_ruleref($uri = "", $type = "", $special = "")
	{
		$resu = '<ruleref';

		if ((isset($uri)) and ($uri!=="")){
			$resu .= ' uri="'.$uri.'"';
		}
		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		if ((isset($special)) and ($special!=="")){
			$resu .= ' special="'.$special.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	function start_ruleref_c($uri = "", $type = "", $special = "")
	{
		$resu = '<ruleref';

		if ((isset($uri)) and ($uri!=="")){
			$resu .= ' uri="'.$uri.'"';
		}
		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		if ((isset($special)) and ($special!=="")){
			$resu .= ' special="'.$special.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  ruleref tag.
	*
	*/
	function end_ruleref()
	{
		$this->_document .= "</ruleref>\n";
	}

	/*
	* Open  token tag.
	*
	* @param	xml_lang

	*/
	function start_token($xml_lang = "")
	{
		$resu = ("<token");

		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  token tag.
	*
	*/
	function end_token()
	{
		$this->_document .= "</token>\n";
	}

	/*
	* Open  tag tag.
	*/
	function start_tag()
	{
		$this->_document .= "<tag>\n";
	}
	
	/*
	* Close  tag tag.
	*
	*/
	function end_tag()
	{
		$this->_document .= "</tag>\n";
	}

	/*
	* Open  one_of tag.
	*
	* @param	xml_lang

	*/
	function start_one_of($xml_lang = "")
	{
		$resu = ("<one-of");

		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  one_of tag.
	*
	*/
	function end_one_of()
	{
		$this->_document .= "</one-of>\n";
	}

	/*
	* Open  item tag.
	*
	* @param	repeat
	* @param	repeat_prob
	* @param	weight
	* @param	xml_lang

	*/
	function start_item($repeat = "", $repeat_prob = "", $weight = "", $xml_lang = "")
	{
		$resu = ("<item");

		if ((isset($repeat)) and ($repeat!=="")){
			$resu .= ' repeat="'.$repeat.'"';
		}
		if ((isset($repeat_prob)) and ($repeat_prob!=="")){
			$resu .= ' repeat-prob="'.$repeat_prob.'"';
		}
		if ((isset($weight)) and ($weight!=="")){
			$resu .= ' weight="'.$weight.'"';
		}
		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  item tag.
	*
	*/
	function end_item()
	{
		$this->_document .= "</item>\n";
	}

	/*
	* Open  rule tag.
	*
	* @param	id	this variable is required
	* @param	scope

	*/
	function start_rule($id = "", $scope = "")
	{
		$resu = ("<rule");

		if ((isset($id)) and ($id!=="")){
			$resu .= ' id="'.$id.'"';
		} else {
			$resu .= ' <!-- Error occured in rule. Need to pass "id"=... -->';
		}

		if ((isset($scope)) and ($scope!=="")){
			$resu .= ' scope="'.$scope.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  rule tag.
	*
	*/
	function end_rule()
	{
		$this->_document .= "</rule>\n";
	}

	/*
	* Open  example tag.
	*/
	function start_example()
	{
		$this->_document .= "<example>\n";
	}
	
	/*
	* Close  example tag.
	*
	*/
	function end_example()
	{
		$this->_document .= "</example>\n";
	}

	/*
	* Open  lexicon tag.
	*
	* @param	uri	this variable is required
	* @param	type

	*/
	function start_lexicon($uri = "", $type = "")
	{
		$resu = '<lexicon';

		if ((isset($uri)) and ($uri!=="")){
			$resu .= ' uri="'.$uri.'"';
		} else {
			$resu .= ' <!-- Error occured in lexicon. Need to pass "uri"=... -->';
		}

		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  lexicon tag.
	*
	*/
	function end_lexicon()
	{
		$this->_document .= "</lexicon>\n";
	}

	/*
	* Open  grammar tag.
	*
	* @param	scope
	* @param	src
	* @param	type
	* @param	weight
	* @param	tag_format
	* @param	xml_base
	* @param	version
	* @param	xml_lang
	* @param	root
	* @param	mode

	*/
	function start_grammar($scope = "", $src = "", $type = "", $weight = "", $tag_format = "", $xml_base = "", $version = "", $xml_lang = "", $root = "", $mode = "")
	{
		$resu = ("<grammar");

		if ((isset($scope)) and ($scope!=="")){
			$resu .= ' scope="'.$scope.'"';
		}
		if ((isset($src)) and ($src!=="")){
			$resu .= ' src="'.$src.'"';
		}
		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		if ((isset($weight)) and ($weight!=="")){
			$resu .= ' weight="'.$weight.'"';
		}
		if ((isset($tag_format)) and ($tag_format!=="")){
			$resu .= ' tag-format="'.$tag_format.'"';
		}
		if ((isset($xml_base)) and ($xml_base!=="")){
			$resu .= ' xml:base="'.$xml_base.'"';
		}
		if ((isset($version)) and ($version!=="")){
			$resu .= ' version="'.$version.'"';
		}
		if ((isset($xml_lang)) and ($xml_lang!=="")){
			$resu .= ' xml:lang="'.$xml_lang.'"';
		}
		if ((isset($root)) and ($root!=="")){
			$resu .= ' root="'.$root.'"';
		}
		if ((isset($mode)) and ($mode!=="")){
			$resu .= ' mode="'.$mode.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  grammar tag.
	*
	*/
	function end_grammar()
	{
		$this->_document .= "</grammar>\n";
	}

	/*
	* Open  record tag.
	*
	* @param	type
	* @param	beep
	* @param	maxtime
	* @param	modal
	* @param	finalsilence
	* @param	dtmfterm

	*/
	function start_record($type = "", $beep = "", $maxtime = "", $modal = "", $finalsilence = "", $dtmfterm = "")
	{
		$resu = ("<record");

		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		if ((isset($beep)) and ($beep!=="")){
			$resu .= ' beep="'.$beep.'"';
		}
		if ((isset($maxtime)) and ($maxtime!=="")){
			$resu .= ' maxtime="'.$maxtime.'"';
		}
		if ((isset($modal)) and ($modal!=="")){
			$resu .= ' modal="'.$modal.'"';
		}
		if ((isset($finalsilence)) and ($finalsilence!=="")){
			$resu .= ' finalsilence="'.$finalsilence.'"';
		}
		if ((isset($dtmfterm)) and ($dtmfterm!=="")){
			$resu .= ' dtmfterm="'.$dtmfterm.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  record tag.
	*
	*/
	function end_record()
	{
		$this->_document .= "</record>\n";
	}

	/*
	* Create  disconnect tag.
	*/
	function start_disconnect()
	{
		$this->_document .= "<disconnect />\n";
	}

	/*
	* Open  transfer tag.
	*
	* @param	dest
	* @param	destexpr
	* @param	bridge
	* @param	connecttimeout
	* @param	maxtime
	* @param	transferaudio
	* @param	aai
	* @param	aaiexpr

	*/
	function start_transfer($dest = "", $destexpr = "", $bridge = "", $connecttimeout = "", $maxtime = "", $transferaudio = "", $aai = "", $aaiexpr = "")
	{
		$resu = ("<transfer");

		if ((isset($dest)) and ($dest!=="")){
			$resu .= ' dest="'.$dest.'"';
		}
		if ((isset($destexpr)) and ($destexpr!=="")){
			$resu .= ' destexpr="'.$destexpr.'"';
		}
		if ((isset($bridge)) and ($bridge!=="")){
			$resu .= ' bridge="'.$bridge.'"';
		}
		if ((isset($connecttimeout)) and ($connecttimeout!=="")){
			$resu .= ' connecttimeout="'.$connecttimeout.'"';
		}
		if ((isset($maxtime)) and ($maxtime!=="")){
			$resu .= ' maxtime="'.$maxtime.'"';
		}
		if ((isset($transferaudio)) and ($transferaudio!=="")){
			$resu .= ' transferaudio="'.$transferaudio.'"';
		}
		if ((isset($aai)) and ($aai!=="")){
			$resu .= ' aai="'.$aai.'"';
		}
		if ((isset($aaiexpr)) and ($aaiexpr!=="")){
			$resu .= ' aaiexpr="'.$aaiexpr.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  transfer tag.
	*
	*/
	function end_transfer()
	{
		$this->_document .= "</transfer>\n";
	}
	
	/*
	* Open  if tag.
	*
	* @param	cond
	*/
	function start_if($cond = "")
	{
		$resu = ("<if");
		
		if ((isset($cond)) and ($cond!=="")){
			$resu .= ' cond="'.$cond.'"';
		} else {
			$resu .= ' <!-- Error occured in lexicon. Need to pass "cond"=... -->';
		}
		
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  if tag.
	*
	*/
	function end_if()
	{
		$this->_document .= "</if>\n";
	}

	/*
	* Open  elseif tag.
	*
	* @param	cond
	*/
	function start_elseif($cond = "")
	{
		$resu = ("<elseif");
		
		if ((isset($cond)) and ($cond!=="")){
			$resu .= ' cond="'.$cond.'"';
		} else {
			$resu .= ' <!-- Error occured in lexicon. Need to pass "cond"=... -->';
		}
		
		$resu .= ("/>\n  ");
		$this->_document .= $resu;
	}

	/*
	* Create  else tag.
	*/
	function start_else()
	{
		$this->_document .= "<else />\n";
	}

	/*
	* Open  exit tag.
	*
	* @param	expr
	* @param	namelist

	*/
	function start_exit($expr = "", $namelist = "")
	{
		$resu = '<exit';

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		if ((isset($namelist)) and ($namelist!=="")){
			$resu .= ' namelist="'.$namelist.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	function start_exit_c($expr = "", $namelist = "")
	{
		$resu = '<exit';

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		if ((isset($namelist)) and ($namelist!=="")){
			$resu .= ' namelist="'.$namelist.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  exit tag.
	*
	*/
	function end_exit()
	{
		$this->_document .= "</exit>\n";
	}

	/*
	* Open  filled tag.
	*
	* @param	mode
	* @param	namelist

	*/
	function start_filled($mode = "", $namelist = "")
	{
		$resu = ("<filled");

		if ((isset($mode)) and ($mode!=="")){
			$resu .= ' mode="'.$mode.'"';
		}
		if ((isset($namelist)) and ($namelist!=="")){
			$resu .= ' namelist="'.$namelist.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  filled tag.
	*
	*/
	function end_filled()
	{
		$this->_document .= "</filled>\n";
	}

	/*
	* Open  goto tag.
	*
	* @param	fetchaudio
	* @param	expritem
	* @param	nextitem

	*/
	function start_goto($next = "", $fetchaudio = "", $expritem = "", $nextitem = "", $expr = "")
	{
		$resu = '<goto';

		if ((isset($next)) and ($next!=="")){
			$resu .= ' next="'.$next.'"';
		}
		
		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		if ((isset($expritem)) and ($expritem!=="")){
			$resu .= ' expritem="'.$expritem.'"';
		}
		if ((isset($nextitem)) and ($nextitem!=="")){
			$resu .= ' nextitem="'.$nextitem.'"';
		}
		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	function start_goto_c($next = "", $fetchaudio = "", $expritem = "", $nextitem = "", $expr = ""){
		$resu = '<goto';

		if ((isset($next)) and ($next!=="")){
			$resu .= ' next="'.$next.'"';
		}
		
		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		if ((isset($expritem)) and ($expritem!=="")){
			$resu .= ' expritem="'.$expritem.'"';
		}
		if ((isset($nextitem)) and ($nextitem!=="")){
			$resu .= ' nextitem="'.$nextitem.'"';
		}
		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  goto tag.
	*
	*/
	function end_goto()
	{
		$this->_document .= "</goto>\n";
	}

	/*
	* Open  param tag.
	*
	* @param	name	this variable is required
	* @param	expr
	* @param	value
	* @param	valuetype
	* @param	type

	*/
	function start_param($name = "", $expr = "", $value = "", $valuetype = "", $type = "")
	{
		$resu = '<param';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in param. Need to pass "name"=... -->';
		}

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		if ((isset($value)) and ($value!=="")){
			$resu .= ' value="'.$value.'"';
		}
		if ((isset($valuetype)) and ($valuetype!=="")){
			$resu .= ' valuetype="'.$valuetype.'"';
		}
		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	function start_param_c($name = "", $expr = "", $value = "", $valuetype = "", $type = ""){
		$resu = '<param';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in param. Need to pass "name"=... -->';
		}

		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		if ((isset($value)) and ($value!=="")){
			$resu .= ' value="'.$value.'"';
		}
		if ((isset($valuetype)) and ($valuetype!=="")){
			$resu .= ' valuetype="'.$valuetype.'"';
		}
		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  param tag.
	*
	*/
	function end_param()
	{
		$this->_document .= "</param>\n";
	}

	/*
	* Open  return tag.
	*
	* @param	namelist

	*/
	function start_return($namelist = "")
	{
		$resu = '<return';

		if ((isset($namelist)) and ($namelist!=="")){
			$resu .= ' namelist="'.$namelist.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	function start_return_c($namelist = ""){
		$resu = '<return';

		if ((isset($namelist)) and ($namelist!=="")){
			$resu .= ' namelist="'.$namelist.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  return tag.
	*
	*/
	function end_return()
	{
		$this->_document .= "</return>\n";
	}

	/*
	* Open  subdialog tag.
	*
	* @param	src
	* @param	srcexpr
	* @param	fetchaudio

	*/
	function start_subdialog($src = "", $srcexpr = "", $fetchaudio = "")
	{
		$resu = ("<subdialog");

		if ((isset($src)) and ($src!=="")){
			$resu .= ' src="'.$src.'"';
		}
		if ((isset($srcexpr)) and ($srcexpr!=="")){
			$resu .= ' srcexpr="'.$srcexpr.'"';
		}
		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  subdialog tag.
	*
	*/
	function end_subdialog()
	{
		$this->_document .= "</subdialog>\n";
	}

	/*
	* Open  submit tag.
	*
	* @param	fetchaudio

	*/
	function start_submit($next = "", $fetchaudio = "")
	{
		$resu = '<submit';

		if ((isset($next)) and ($next!=="")){
			$resu .= ' next="'.$next.'"';
		}
		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Open  submit tag.
	*
	* @param	fetchaudio

	*/
	function start_submit_c($next = "", $fetchaudio = "")
	{
		$resu = '<submit';
		
		if ((isset($next)) and ($next!=="")){
			$resu .= ' next="'.$next.'"';
		}
		if ((isset($fetchaudio)) and ($fetchaudio!=="")){
			$resu .= ' fetchaudio="'.$fetchaudio.'"';
		}
		$resu .= "/>\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  submit tag.
	*
	*/
	function end_submit()
	{
		$this->_document .= "</submit>\n";
	}

	/*
	* Open  log tag.
	*
	* @param	label
	* @param	expr

	*/
	function start_log($label = "", $expr = "")
	{
		$resu = ("<log");

		if ((isset($label)) and ($label!=="")){
			$resu .= ' label="'.$label.'"';
		}
		if ((isset($expr)) and ($expr!=="")){
			$resu .= ' expr="'.$expr.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  log tag.
	*
	*/
	function end_log()
	{
		$this->_document .= "</log>\n";
	}

	/*
	* Open  object tag.
	*
	* @param	classid
	* @param	codebase
	* @param	data
	* @param	type
	* @param	codetype
	* @param	archive

	*/
	function start_object($classid = "", $codebase = "", $data = "", $type = "", $codetype = "", $archive = "")
	{
		$resu = ("<object");

		if ((isset($classid)) and ($classid!=="")){
			$resu .= ' classid="'.$classid.'"';
		}
		if ((isset($codebase)) and ($codebase!=="")){
			$resu .= ' codebase="'.$codebase.'"';
		}
		if ((isset($data)) and ($data!=="")){
			$resu .= ' data="'.$data.'"';
		}
		if ((isset($type)) and ($type!=="")){
			$resu .= ' type="'.$type.'"';
		}
		if ((isset($codetype)) and ($codetype!=="")){
			$resu .= ' codetype="'.$codetype.'"';
		}
		if ((isset($archive)) and ($archive!=="")){
			$resu .= ' archive="'.$archive.'"';
		}
		$resu .= (">\n  ");
		$this->_document .= $resu;
	}
	
	/*
	* Close  object tag.
	*
	*/
	function end_object()
	{
		$this->_document .= "</object>\n";
	}

	/*
	* Open  property tag.
	*
	* @param	name	this variable is required
	* @param	value	this variable is required

	*/
	function start_property($name = "", $value = "")
	{
		$resu = '<property';

		if ((isset($name)) and ($name!=="")){
			$resu .= ' name="'.$name.'"';
		} else {
			$resu .= ' <!-- Error occured in property. Need to pass "name"=... -->';
		}

		if ((isset($value)) and ($value!=="")){
			$resu .= ' value="'.$value.'"';
		} else {
			$resu .= ' <!-- Error occured in property. Need to pass "value"=... -->';
		}

		$resu .= ">\n  ";
		$this->_document .= $resu;
	}
	
	/*
	* Close  property tag.
	*
	*/
	function end_property()
	{
		$this->_document .= "</property>\n";
	}

	/*
	* Open  script tag.
	*/
	function start_script()
	{
		$this->_document .= "<script>\n";
	}
	
	/*
	* Close  script tag.
	*
	*/
	function end_script()
	{
		$this->_document .= "</script>\n";
	}

	/*
	* Begin Block Tag.
	*
	* @param	name
	* @param	expr
	* @param	cond
	*/
	function start_block($name = "", $expr = "", $cond = "")
	{
		$resu = "<block";
		if ((isset($name)) and ($name!=="")){
		$resu.=" name=\"".$name."\"";
		}
		if ((isset($expr)) and ($expr!=="")){
		$resu.=" expr=\"".$expr."\"";
		}
		if ((isset($cond)) and ($cond!=="")){
		$resu.=" cond=\"".$cond."\"";
		}
		$resu .= ">\n  ";
		
		$this->_document .= $resu;
	}

	/*
	* End Block Tag.
	*
	*/
	function end_block()
	{
		$this->_document .= "</block>\n";
	}
	
	function start_nomatch($count = "")
	{
		$resu = "<nomatch";
		
		if ((isset($count)) and ($count!=="")){
			$resu.=" count=\"".$count."\"";
		}
		
		$resu .= ">\n  ";
		
		$this->_document .= $resu;
	}
	

	function end_nomatch()
	{
		$this->_document .= "</nomatch>\n";
	}
	
	function start_noinput($count = "")
	{
		$resu = "<noinput";
		
		if ((isset($count)) and ($count!=="")){
			$resu.=" count=\"".$count."\"";
		}
		
		$resu .= ">\n  ";
		
		$this->_document .= $resu;
	}
	

	function end_noinput()
	{
		$this->_document .= "</noinput>\n";
	}
		
  /*
	* 
	* Place content between VoiceXML tags.
	* 
	* @param	text	text to display
	*/
	function write($text = "") 
	{
	 	$this->_document .= ' '.$text."\n".' ';
	}

   /*
	* 
	* Load a VXML Module to extends class funtionnalities.
	* 
	* @param	module	module name and method to call (module::method)
	* @param	params	array of parameters to use when calling the module methods.
	*/
	function load($module,$params = "")
	{
		
		if (ereg('::',$module)) {
			$d = explode('::',$module);
			$module = $d[0];
			$method = $d[1];
		}
		
		// Usage of absolute path to library
		if (ereg('WIN',PHP_OS)) {
			$path = explode('\\', __FILE__);
		} else $path = explode('/', __FILE__);
		array_pop($path) ;
		$path = implode('/',$path);


		if (is_file("$path/vxml_mods/{$module}.class.php")) {
			
			require_once("$path/vxml_mods/$module.class.php");

			$m = new $module($this,$params);
			if (isset($method)) {
				$m->$method($params);
			}
			unset($m);
		}
	}
	
	/**
	* 
	* Function to add a JavaScript to your VXML document
	* 
	* @param script			The script itself
	* 
	
	* @return void
	*/
	
	function addscript($script)
	{
		$this->_document .= "<![CDATA[\n  ".$script."\n]]>\n";
	}
	
	/*
	* 
	* Echo generated  vxml application to user.
	* 
	*/
	function generate()
	{
		echo $this->_document;
	}
 
}

?>
Return current item: PHP Voice