VoiceXML 2.1 Development Guide Home  |  Frameset Home


<vxml>  element

The vxml element is the initial declaration that defines a document as a VoiceXML application.


usage
<vxml application="CDATA" version="(2.0|2.1)" xml:base="CDATA" xml:lang="NMTOKEN" xmlns="http://www.w3.org/2001/vxml" xmlns:voxeo="http://community.voxeo.com/xmlns/vxml">


attributes
application Data Type: CDATA Default: Optional
The value of  the application attribute is a URI used to specify the applications root document. When specified, all event handlers, variables, links, grammars, and scripts contained within the root document are considered active when each document  loads. All variables declared within the root document are then considered to have application scope, and are available at any point in the application.
version Data Type: (2.0|2.1) Default: Optional
The version attribute represents the VoiceXML version number. Note that specifying the version as '2.1' is required when using the new 2.1 elements, such as the data element.
xml:base Data Type: CDATA Default: Optional
The URI value of the xml:base attribute denotes the base URL of the document. All relative URI’s contained in the document are derived from the base attributes value. If unspecified, then the platform assumes that the current URI is the value of the base attribute.
xml:lang Data Type: NMTOKEN Default: Optional (en-US)
The xml:lang attribute specifies the language and locale information of the VoiceXML document. If omitted, it will inherit this value from the document hierarchy, or ultimately from the platform default, which equates to 'en-US'.
xmlns Data Type: http://www.w3.org/2001/vxml Default: http://www.w3.org/2001/vxml
The xmlns attribute defines the VoiceXML namespace; all tags and attributes belong to this namespace. If specifying the xmlns:nuance attribute in your code, this element will be filled in by default.
xmlns:voxeo Data Type: http://community.voxeo.com/xmlns/vxml Default: none - attribute is optional
The 'xmlns:voxeo' attribute is a required setting that refers to the xml namespace used when a developer includes a voxeo extension element to the VXML specification, (such as <voxeo:recordcall>). This attribute value should always be specified as 'http://community.voxeo.com/xmlns/vxml'



shadow variables
none


parents
none


children
<catch> <error> <form> <help> <link> <menu> <meta> <noinput> <nomatch> <property> <script> <var>


code samples
<AppRoot.vxml>
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">


<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<catch event="GlobalEvent">
        <prompt> we caught a global event. </prompt>
    </catch>

<form id="F1">
  <block>
    <prompt>
      here is some text that will not be executed.
    </prompt>
    </block>
</form>
</vxml>

<Vxml application-xml:base> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1"
application="AppRoot.vxml" xml:base="http://ThisServer/ThisDirectory/">



<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1">
  <block>
    <prompt> preparing to throw a global event, which will be
          caught by the application root document.
    </prompt>
    <throw event="GlobalEvent"/>
  </block>
</form>
</vxml>



additional links
W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
jasrags
4/30/2004 1:06 PM (EDT)
in :
code samples

2.-0 <AppRoot.vxml>

<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.0" <----- Missing tailing ">"
MattHenry
4/30/2004 1:48 PM (EDT)
Thanks for catching yet another typo for me; i have this fixed in the most recent build.

~Matt
awirtz
1/26/2005 8:38 PM (EST)
If you need to track down XML syntax errors in a VXML document, you might try adding the following DOCTYPE element and using an XML validator:

<!DOCTYPE vxml SYSTEM "http://www.w3.org/TR/voicexml21/vxml.dtd">

This tag should be placed after the <?xml?> tag and before the <vxml> tag in your document.  There is a publicly available XML validator here:

http://www.stg.brown.edu/service/xmlvalid/

(Note that the first 4 warnings it outputs are complaints about the DTD file at W3 and are not directed at your document.  Ignore them.)
codingace
1/23/2008 2:47 PM (EST)
This is great for manually throwing an event, but what if a hangup or disconnect takes place? Is there a nice way to handle the catch event at the application level?
VoxeoDustin
1/23/2008 4:44 PM (EST)
Hey,

There sure is. You'll simply need to create a root document that contains your <catch>.

For example:

root.vxml
--------
<?xml version="1.0"?>
<vxml version="2.1">

  <catch event="connection.disconnect.hangup">
      <!-- do our clean up -->
    <exit/>
    <!-- we absolutely MUST explicitly exit in any connection.disconnect handler
    to kill the session -->
  </catch>

</vxml>


leaf.vxml
--------
<?xml version="1.0"?>
<vxml version="2.1" application="root.vxml">

<!-- our code here -->

</vxml>

Note: The <catch> event must be scoped at the <vxml> level and that your leaf documents must have a voice reco field for the event to be caught.

Thanks,
Dustin
jaffar
6/11/2008 8:03 AM (EDT)
i want to create a vxml file in that i want to validate the user three times..like first i want to confirm his name,pin,password..
can u please giv me the vxml code for that....
voxeojeremyr
6/11/2008 11:07 AM (EDT)
Hi,

We have lots of examples in our tutorials about things like this that you can find here:
http://docs.voxeo.com/voicexml/2.0/learningvoicexml.htm

But also, here is some sample code that should pint you in the right direction:

<form>
    <field name = "name">
          <prompt> What is the name? </prompt>
          <grammar type="application/grammar+xml" src= "name.grxml"/>
    </field>
    <field name = "pin" type="digits">
          <prompt> What is your pin? </prompt>
    </field>
    <filled>
          <if cond = "pin != '1234'">
                <prompt> That is the wrong pin </prompt>
                <reprompt/>
                <clear namelist = "pin"/>
            </if>
      </filled>
</form>

Thanks,
Jeremy Richmond
Voxeo Support

login



© 2003-2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site