Home > Articles > Web Services > XML

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

This chapter is from the book

3.34 object

Element type

object

Attributes

archive | classid | codebase | codetype | cond | data | expr | fetchhint | fetchtimeout | maxage (2.0) | maxstale (2.0) | name | type

Parents

form

Children

PCDATA | audio | catch | enumerate | error | filled | help | noinput | nomatch | param | prompt | property | value

Description

The object element is used to call platform-specific functionality resident in the VoiceXML interpreter itself. The implementation of the object element by VoiceXML platforms is intended to provide a way to call methods written in some object-oriented programming language like C++ or Java on native VoiceXML objects.

DTD

<!ELEMENT object
 (%audio; | %event.handler; | filled | param | prompt | property)* >
<!ATTLIST object
  %item.attrs;
  %cache.attrs;
  classid       %uri; #IMPLIED
  codebase      %uri; #IMPLIED
  data          %uri; #IMPLIED
  type          CDATA #IMPLIED
  codetype      CDATA #IMPLIED
  archive       %uri; #IMPLIED >

Language model

03fig34.gif

Attributes

  • archive : uri

    A space separated list of URIs for resources required by the implementing class.

  • classid : uri

    The URI of the class containing the method to call. The URI convention is platform-specific.

  • codebase : uri

    The base path used to resolve relative URIs specified by classid, data, and archive. It defaults to the base URI of the current document.

  • codetype : CDATA

    The type of data stored at the URI specified with the classid attribute.

  • cond : expression = true

    A guard condition associated with this form item, written as an ECMAScript expression. This expression must evaluate to true for the Form Interpretation Algorithm to visit this form item.

  • data : uri

    The URI specifying the location of the object's data. If it is a relative URI, it is interpreted relative to the codebase attribute.

  • expr : expression = undefined

    An ECMAScript expression defining an initial value for this form item. The Form Interpretation Algorithm will visit object only if the expression evaluates to undefined.

  • 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.

  • name : field.name

    The name associated with this form item. When the caller fills this form-item, by producing an utterance that matches that item's grammar, the value will be stored in a variable of this name visible from within the containing form element.

  • type : CDATA

    The data type of the contents of the URI specified with the data attribute.

Children

  • param element

    Is used to pass parameters to the object call.

  • prompt and any audible child of object

    Are played before executing the native object call.

  • event.handler elements

    Specify event handlers local to the scope of this object element.

  • property element

    Is used to specify interpreter properties local to this object element.

Examples

Example 3-40 Using object to access platform-specific features

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="2.0">
  <form id="authenticate">
    <field name="userid" type="digits">
      <prompt>Please enter your user-id.</prompt>
    </field>

    <object name="verified" type="boolean"
        codebase="www.example.com/voiceJars"
        classid="method://NativeSpeakerAuthentication.authenticate"
        data="SpeakerAuth.jar" codetype="lang/java">
      <param name="userID" expr="userid"/>
      <param name="tolerance" expr=".10"/>
    </object>

    <filled>
      <if cond="verified=='true'">
        <prompt>Login successful.</prompt>
        <submit next="www.example.com/accessAccount"
                namelist="userid"/>
        <else/>
        <prompt>Voiceprint unsuccessful. Goodbye.</prompt>
        <disconnect/>
      </if>
    </filled>
  </form>
</vxml>
  • + Share This
  • 🔖 Save To Your Account