Last reviewed: 3/23/2024 12:05:34 PM
<data>
The <data> element allows a VoiceXML application to fetch arbitrary XML data from a document server without transitioning to a new VoiceXML document.
Syntax
<form id="get_quote">
<<block>>
<data name="quote" srcexpr="'http://www.example.org/getquote?ticker=' + ticker"/>
<assign name="document.quote" expr="quote.documentElement"/>
<goto next="#play_quote"/>
</block>
</form>
Attributes
enctype
The media encoding type of the submitted document.
Media Encoding Type | Description |
---|---|
text/plain | See Form content types. |
multipart/form-data | See Form content types. |
fetchaudio
The URI of the audio clip to play while the fetch is being done. If not specified, the fetchaudio property is used, and if that property is not set, no audio is played during the fetch. The fetching of the audio clip is governed by the audiofetchhint, audiomaxage, audiomaxstale, and fetchtimeout properties in effect at the time of the fetch. The playing of the audio clip is governed by the fetchaudiodelay, and fetchaudiominimum properties in effect at the time of the fetch. The default value is the fetchaudio property.
fetchhint
Defines when the interpreter context should retrieve content from the server. If not specified, a value derived from the innermost relevant fetchhint property is used. The default value is the documentfetchhint property.
Fetch Type | Description |
---|---|
prefetch | Indicates a file may be downloaded when the page is loaded. |
safe | Indicates a file that should only be downloaded when actually needed. |
fetchtimeout
The interval to wait for the content to be returned before throwing an error.badfetch event. The value is a Time Designation. The default value is the fetchtimeout property.
maxage
Indicates that the document is willing to use content whose age is no greater than the specified time in seconds. The default value is the audiomaxage property.
maxstale
Indicates that the document is willing to use content that has exceeded its expiration time. The default value is the audiomaxstale property.
method
The request method: get (the default) or post.
name
The name of the variable that exposes the DOM.
namelist
The list of variables to submit. By default, no variables are submitted. If a namelist is supplied, it may contain individual variable references which are submitted with the same qualification used in the namelist. Declared VoiceXML and ECMAScript variables can be referenced.
src
The URI of the audio prompt.
srcexpr
The URI is dynamically determined by evaluating the given ECMAScript expression when the data needs to be fetched. If srcexpr cannot be evaluated, an error.semantic event is thrown.
Children
none
Parents
<block>, <catch>, <error>, <filled>, <form>, <help>, <if>, <noinput>, <nomatch>, <prompt>, and <vxml>.
Variables
none
Example
The following example illustrates using example elements.
<?xml version="1.0" encoding="UTF-8"?>
<quote xmlns="http://www.example.org">
<ticker>F</ticker>
<name>Ford Motor Company</name>
<change>1.00</change>
<last>30.00</last>
</quote>
<data name="quote" src="quote.xml"/>
<script><![CDATA[
var price = quote.documentElement.getElementsByTagNameNS("http://www.example.org", "last").item(0).firstChild.data;
]]></script>
Version Information
Supported in: VoiceXML 2.1.