<data>

The <data> element allows a VoiceXML application to fetch arbitrary XML data from 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 W3C Document Object Model (DOM).

Attributes

src The URI specifying the location of the XML data to retrieve.
name The name of the variable that exposes the DOM.
srcexpr Like src, except that 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.
method (defaults to "get") The request method: get or post.
namelist The list of variables to submit. The default is to submit no variables. If a namelist is supplied, it may contain individual variable references that are submitted with the same qualification used in the namelist. Declared VoiceXML and ECMAScript variables can be referenced.
enctype (defaults to "application/x-www-form-urlencoded") This attribute specifies the HTTP POST encoding format. The other permissible choice is "multipart/form-data" which is the encoding method used by the platform when binary data is being submitted.
fetchaudio (defaults to "fetchaudio" global property value) The URI of the audio clip to play while the fetch is being done.
fetchhint This attribute is not supported.
fetchtimeout (defaults to "fetchtimeout" global property value) The timeout for fetches. Must be specified with the appropriate time units (e.g., "120s" for 120 seconds).
maxage (defaults to "documentmaxage" global property value) Tells the platform the maximum acceptable age, in seconds, of cached documents.
maxstale (defaults to "documentmaxstale" global property value) Tells the platform the maximum acceptable staleness, in seconds, of expired cached documents.

Notes

Exactly one of "src" and "srcexpr" must be specified. Please refer to the VoiceXML 2.1 Draft for examples and detailed usage information for this tag.


Example

data.vxml
<?xml version="1.0"?>
<vxml version="2.1">
  <form>
    <data name="domstuff" src="datatag.xml"/>
    <block>
      Hello <value expr="domstuff.documentElement.firstChild.toString()"/>.
    </block>
  </form>
</vxml>
datatag.xml
<?xml version="1.0"?>
<tagname>
  World
</tagname>

The output of the above script would be:

Computer: Hello World.



Child Tags

None



Parent Tags

<block>, <catch>, <error>, <filled>, <foreach>, <form>, <help>, <if>, <noinput>, <nomatch>, <vxml>