Enables a VoiceXML application to fetch arbitrary XML data from and submit data to, a document server, without transitioning to a new VoiceXML document. The XML data fetched by the <data> element is bound to ECMAScript through the named variable that exposes a read-only subset of the XML DOM.
<data
enctype = "CDATA"
fetchaudio = "URI"
fetchhint = "{prefetch | safe}"
fetchtimeout = "CDATA"
maxage = "CDATA"
maxstale = "CDATA"
method = "{get | post}"
name = "identifier"
namelist = "list of identifiers"
src = "URI"
srcexpr = "CDATA"
/>
None of the attributes for <data> are required.
Attribute |
Data Type |
Required? |
Default |
Description |
enctype |
CDATA |
no |
application/x-www-form-urlencoded |
MIME encoding type to use when submitting data. Specify a MIME type of multipart/form-data to upload the audio file that results from a record operation. |
fetchaudio |
URI |
no |
NA |
URI of an audio resource to play while the XML data is fetched. If the fetchaudio attribute is not set, no audio is played during the fetch. If the audio is playing after the XML document is fetched, the audio terminates. |
fetchhint |
{prefetch | safe} |
no |
NA |
Specifies when the VoiceXML Interpreter context should retrieve content from the server. Valid values:
|
fetchtimeout |
CDATA |
no |
NA |
Interval to wait for the content to be returned before throwing an error.badfetch event. Use s for seconds (for example, 1s) and ms for milliseconds (for example, 1ms). |
maxage |
CDATA |
no |
NA |
Maximum acceptable age, in seconds, of a resource being fetched from the cache. Setting maxage to 0 means that a cached version is never considered fresh. |
maxstale |
CDATA |
no |
NA |
Maximum acceptable staleness, in seconds, of the resource being fetched, if the fetched resource is cached and expired. |
method |
CDATA |
no |
get |
HTTP request method. Valid values:
|
name |
identifier |
no |
NA |
Name of the variable that exposes the XML DOM. This must be a legal ECMAScript identifier. |
namelist |
list of identifiers |
no |
NA |
Space-separated list of variables submitted. By default, no variables are submitted. |
src |
URI |
no |
NA |
URI that specifies the location of the XML data to retrieve. |
srcexpr |
CDATA |
no |
NA |
ECMAScript expression that evaluates to the URI specifying the location of the XML data to retrieve. |
<block>, <catch>, <error>, <filled>, <foreach>, <form>, <help>, <if>, <noinput>, <nomatch>, <vxml>
None.
<?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>
VoiceXML that retrieves a stock quote from the XML document:
<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<data name="quote" src="quote.xml" maxage="0"/>
<script>
var price = quote.documentElement.getElementsByTagName("last").
item(0).firstChild.data;
</script>
<form>
<block>
Price is <value expr="price"/>
</block>
</form>
</vxml>