Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

3.26 link

Element type

link

Attributes

dtmf (2.0) | expr | expritem | fetchaudio | fetchhint | fetchtimeout | maxage (2.0) | maxstale (2.0) | next | nextitem

Parents

field | form | initial | vxml

Children

grammar

Description

When the user input matches one or more grammars in the scope of a link element, the link will be activated, either throwing an event or passing control to another document.

DTD

<!ELEMENT link (grammar)* >
<!ATTLIST link
  %cache.attrs;
  %next.attrs;
  fetchaudio    %uri;        #IMPLIED
  dtmf          CDATA        #IMPLIED
  event         %event.name; #IMPLIED >

Language model

03fig26.gif

Attributes

  • dtmf : CDATA

    The DTMF sequence that will activate this link, in addition to the other link grammars defined.

  • event : event.name

    The event to throw when the user matches one of the link's grammars.

  • expr : expression

    An ECMAScript expression that yields the destination URI.

  • fetchaudio : uri

    The URI of the audio to play while fetching a document.

  • fetchhint : (prefetch | safe)

    Indicates whether the interpreter may prefetch the destination document specified by this element's next attribute. A value of prefetch indicates the resource may be retrieved at the time the containing VoiceXML document is retrieved. A value of safe indicates that the resource specified by this element should not be prefetched, but should instead be retrieved at the time that the interpreter executes this element.

  • fetchtimeout : duration

    The interval to wait for the content to be returned before throwing an error.badfetch event. If this attribute is not specified, the interpreter derives a value from the most locally scoped fetchtimeout property.

  • maxage : integer

    Indicates the maximum allowable age of the fetched document in seconds. If the cached copy is older than the specified maxage, a new copy will be fetched when the interpreter executes this element. If this attribute is not specified, the interpreter derives a value from the most locally scoped maxage property. If no maxstale attribute is defined and it is impossible to fetch a new copy on the content the interpreter will throw an error.badfetch instead of using stale content.

  • maxstale : integer

    Indicates that the interpreter may use stale content for this element as long as its age is no older than maxage plus the value of maxstale in seconds. If this attribute is not specified, the interpreter derives a value from the most locally scoped maxstale property.

  • next : uri

    The destination URI.

Children

  • grammar elements

    When matched, these will cause this link element to either pass control to another form or form.item, or throw an event.

Examples

Example 3-30 link used to throw events or jump to other dialogs

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0">
  <link event="newspaper">
    <grammar>
      New York Times | Wall Street Journal | Herald Tribune
    </grammar>
  </link>
  <link event="magazine">
    <grammar>Newsweek | Time | The Economist</grammar>
  </link>
  <link next="#other">
    <grammar>radio | tv | web</grammar>
  </link>
  <catch event="newspaper">
    <prompt>So you prefer reading the newspaper.</prompt>
    <exit/>
  </catch>
  <catch event="magazine">
    <prompt>So you prefer reading magazines.</prompt>
  </catch>

  <form id="main">
    <field>
      <prompt>
        Please say the name of your preferred source for news.
      </prompt>
    </field>
  </form>

  <form id="other">
    <block>
      <prompt>So you prefer other news sources to newspapers
              and magazines.</prompt>
    </block>
  </form>
</vxml>
  • + Share This
  • 🔖 Save To Your Account