VoiceXML 2.1
Posted: Mon Aug 21, 2006 2:07 pm
I'm testing a few features of VoiceXML 2.1 on your site. I've been getting an error message using the followint script.
<?xml version="1.0" encoding ="UTF-8"?>
<!DOCTYPE vxml PUBLIC "-//W3C//DTD VOICEXML 2.1//EN" "http://www.w3.org/TR/voicexml21/vxml.dtd">
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<meta name="creator" content="james.mclaurin@comcast.net"/>
<var name="quote"/>
<var name="ticker" expr="'f'"/>
<form id="get_quote">
<block>
<data name="quote" srcexpr="'quotedata.xml'"/>
<assign name="document.quote" expr="quote.documentElement"/>
<goto next="#play_quote"/>
</block>
</form>
<form id="play_quote">
<script>
<![CDATA[
// retrieve the value contained in the node t from the DOM exposed by d
function GetData(d, t, nodata) {
try {
return d.getElementsByTagName(t).item(0).firstChild.data;
}
catch(e) {
// the value could not be retrieved, so return this instead
return nodata;
}
}
]]>
</script>
<block>
<!-- retrieve the change in the stock's value -->
<var name="change" expr="GetData(quote, 'change', 0)"/>
<!--Say the company name -->
<prompt>
The stock for <value expr="GetData(quote, 'name', 'unknown')"/> is
</prompt>
<!-- Say the current price per share -->
<prompt> <value expr="GetData(quote, 'last', 0)"/> </prompt>
</block>
</form>
</vxml>
----
quotedata.xml
<?xml version="1.0" encoding="UTF-8"?>
<quote>
<ticker>F</ticker>
<name>Ford Motor Company</name>
<change>1.00</change>
<last>30.00</last>
</quote>
Any thoughts? This sample is from VoiceXML Forum.
Thanks ...
<?xml version="1.0" encoding ="UTF-8"?>
<!DOCTYPE vxml PUBLIC "-//W3C//DTD VOICEXML 2.1//EN" "http://www.w3.org/TR/voicexml21/vxml.dtd">
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<meta name="creator" content="james.mclaurin@comcast.net"/>
<var name="quote"/>
<var name="ticker" expr="'f'"/>
<form id="get_quote">
<block>
<data name="quote" srcexpr="'quotedata.xml'"/>
<assign name="document.quote" expr="quote.documentElement"/>
<goto next="#play_quote"/>
</block>
</form>
<form id="play_quote">
<script>
<![CDATA[
// retrieve the value contained in the node t from the DOM exposed by d
function GetData(d, t, nodata) {
try {
return d.getElementsByTagName(t).item(0).firstChild.data;
}
catch(e) {
// the value could not be retrieved, so return this instead
return nodata;
}
}
]]>
</script>
<block>
<!-- retrieve the change in the stock's value -->
<var name="change" expr="GetData(quote, 'change', 0)"/>
<!--Say the company name -->
<prompt>
The stock for <value expr="GetData(quote, 'name', 'unknown')"/> is
</prompt>
<!-- Say the current price per share -->
<prompt> <value expr="GetData(quote, 'last', 0)"/> </prompt>
</block>
</form>
</vxml>
----
quotedata.xml
<?xml version="1.0" encoding="UTF-8"?>
<quote>
<ticker>F</ticker>
<name>Ford Motor Company</name>
<change>1.00</change>
<last>30.00</last>
</quote>
Any thoughts? This sample is from VoiceXML Forum.
Thanks ...